gfx/skia/trunk/src/utils/SkEventTracer.cpp

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 2014 Google Inc.
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 #include "SkEventTracer.h"
michael@0 9 #include "SkOnce.h"
michael@0 10
michael@0 11 class SkDefaultEventTracer: public SkEventTracer {
michael@0 12 virtual SkEventTracer::Handle
michael@0 13 addTraceEvent(char phase,
michael@0 14 const uint8_t* categoryEnabledFlag,
michael@0 15 const char* name,
michael@0 16 uint64_t id,
michael@0 17 int numArgs,
michael@0 18 const char** argNames,
michael@0 19 const uint8_t* argTypes,
michael@0 20 const uint64_t* argValues,
michael@0 21 uint8_t flags) SK_OVERRIDE { return 0; }
michael@0 22
michael@0 23 virtual void
michael@0 24 updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
michael@0 25 const char* name,
michael@0 26 SkEventTracer::Handle handle) SK_OVERRIDE {};
michael@0 27
michael@0 28 virtual const uint8_t* getCategoryGroupEnabled(const char* name) SK_OVERRIDE {
michael@0 29 static uint8_t no = 0;
michael@0 30 return &no;
michael@0 31 };
michael@0 32 virtual const char* getCategoryGroupName(
michael@0 33 const uint8_t* categoryEnabledFlag) SK_OVERRIDE {
michael@0 34 static const char* dummy = "dummy";
michael@0 35 return dummy;
michael@0 36 };
michael@0 37 };
michael@0 38
michael@0 39 SkEventTracer *SkEventTracer::gInstance;
michael@0 40
michael@0 41 static void intialiize_default_tracer(void *current_instance) {
michael@0 42 if (NULL == current_instance) {
michael@0 43 SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer));
michael@0 44 }
michael@0 45 }
michael@0 46
michael@0 47 static void cleanup_tracer() {
michael@0 48 // calling SetInstance will delete the existing instance.
michael@0 49 SkEventTracer::SetInstance(NULL);
michael@0 50 }
michael@0 51
michael@0 52 SkEventTracer* SkEventTracer::GetInstance() {
michael@0 53 SK_DECLARE_STATIC_ONCE(once);
michael@0 54 SkOnce(&once,
michael@0 55 intialiize_default_tracer,
michael@0 56 SkEventTracer::gInstance,
michael@0 57 cleanup_tracer);
michael@0 58 SkASSERT(NULL != SkEventTracer::gInstance);
michael@0 59 return SkEventTracer::gInstance;
michael@0 60 }

mercurial