gfx/skia/trunk/include/utils/SkEventTracer.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /*
michael@0 2 * Copyright (C) 2014 Google Inc. All rights reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef SkEventTracer_DEFINED
michael@0 9 #define SkEventTracer_DEFINED
michael@0 10
michael@0 11 // The class in this header defines the interface between Skia's internal
michael@0 12 // tracing macros and an external entity (e.g., Chrome) that will consume them.
michael@0 13 // Such an entity should subclass SkEventTracer and provide an instance of
michael@0 14 // that event to SkEventTracer::SetInstance.
michael@0 15
michael@0 16 // If you're looking for the tracing macros to instrument Skia itself, those
michael@0 17 // live in src/core/SkTraceEvent.h
michael@0 18
michael@0 19 #include "SkTypes.h"
michael@0 20
michael@0 21 // This will mark the trace event as disabled by default. The user will need
michael@0 22 // to explicitly enable the event.
michael@0 23 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name
michael@0 24
michael@0 25 class SK_API SkEventTracer {
michael@0 26 public:
michael@0 27
michael@0 28 typedef uint64_t Handle;
michael@0 29
michael@0 30 static SkEventTracer* GetInstance();
michael@0 31
michael@0 32 static void SetInstance(SkEventTracer* tracer) {
michael@0 33 SkDELETE(SkEventTracer::gInstance);
michael@0 34 SkEventTracer::gInstance = tracer;
michael@0 35 }
michael@0 36
michael@0 37 virtual ~SkEventTracer() { }
michael@0 38
michael@0 39 // The pointer returned from GetCategoryGroupEnabled() points to a
michael@0 40 // value with zero or more of the following bits. Used in this class only.
michael@0 41 // The TRACE_EVENT macros should only use the value as a bool.
michael@0 42 // These values must be in sync with macro values in trace_event.h in chromium.
michael@0 43 enum CategoryGroupEnabledFlags {
michael@0 44 // Category group enabled for the recording mode.
michael@0 45 kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0,
michael@0 46 // Category group enabled for the monitoring mode.
michael@0 47 kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1,
michael@0 48 // Category group enabled by SetEventCallbackEnabled().
michael@0 49 kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2,
michael@0 50 };
michael@0 51
michael@0 52 virtual const uint8_t* getCategoryGroupEnabled(const char* name) = 0;
michael@0 53 virtual const char* getCategoryGroupName(
michael@0 54 const uint8_t* categoryEnabledFlag) = 0;
michael@0 55
michael@0 56 virtual SkEventTracer::Handle
michael@0 57 addTraceEvent(char phase,
michael@0 58 const uint8_t* categoryEnabledFlag,
michael@0 59 const char* name,
michael@0 60 uint64_t id,
michael@0 61 int32_t numArgs,
michael@0 62 const char** argNames,
michael@0 63 const uint8_t* argTypes,
michael@0 64 const uint64_t* argValues,
michael@0 65 uint8_t flags) = 0;
michael@0 66
michael@0 67 virtual void
michael@0 68 updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
michael@0 69 const char* name,
michael@0 70 SkEventTracer::Handle handle) = 0;
michael@0 71 private:
michael@0 72 static SkEventTracer *gInstance;
michael@0 73 };
michael@0 74
michael@0 75 #endif // SkEventTracer_DEFINED

mercurial