Hash :
33e72d99
        
        Author :
  
        
        Date :
2018-06-29T10:49:38
        
      
Removed an assert about addTraceEvent not returning empty handles. There are several codepaths where this is the expected result: * Other threads disabling the category in question. * The TraceBuffer being fill and no new chunks available. * Perfetto being active as the tracing backend. In all cases, the single use of a handle to a TraceEvent is TraceLog::UpdateTraceEventDuration which handles the above cases correctly. BUG=844421 Change-Id: Ieaf3aa5c913cee8c51cfea637907d5bc3b560ceb Reviewed-on: https://chromium-review.googlesource.com/1120841 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "common/event_tracer.h"
#include "common/debug.h"
namespace angle
{
const unsigned char *GetTraceCategoryEnabledFlag(const char *name)
{
    auto *platform = ANGLEPlatformCurrent();
    ASSERT(platform);
    const unsigned char *categoryEnabledFlag =
        platform->getTraceCategoryEnabledFlag(platform, name);
    if (categoryEnabledFlag != nullptr)
    {
        return categoryEnabledFlag;
    }
    static unsigned char disabled = 0;
    return &disabled;
}
angle::TraceEventHandle AddTraceEvent(char phase,
                                      const unsigned char *categoryGroupEnabled,
                                      const char *name,
                                      unsigned long long id,
                                      int numArgs,
                                      const char **argNames,
                                      const unsigned char *argTypes,
                                      const unsigned long long *argValues,
                                      unsigned char flags)
{
    auto *platform = ANGLEPlatformCurrent();
    ASSERT(platform);
    double timestamp = platform->monotonicallyIncreasingTime(platform);
    if (timestamp != 0)
    {
        angle::TraceEventHandle handle =
            platform->addTraceEvent(platform, phase, categoryGroupEnabled, name, id, timestamp,
                                    numArgs, argNames, argTypes, argValues, flags);
        return handle;
    }
    return static_cast<angle::TraceEventHandle>(0);
}
}  // namespace angle