Sat, 03 Jan 2015 20:18:00 +0100
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.
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
8 #include "SkEventTracer.h"
9 #include "SkOnce.h"
11 class SkDefaultEventTracer: public SkEventTracer {
12 virtual SkEventTracer::Handle
13 addTraceEvent(char phase,
14 const uint8_t* categoryEnabledFlag,
15 const char* name,
16 uint64_t id,
17 int numArgs,
18 const char** argNames,
19 const uint8_t* argTypes,
20 const uint64_t* argValues,
21 uint8_t flags) SK_OVERRIDE { return 0; }
23 virtual void
24 updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
25 const char* name,
26 SkEventTracer::Handle handle) SK_OVERRIDE {};
28 virtual const uint8_t* getCategoryGroupEnabled(const char* name) SK_OVERRIDE {
29 static uint8_t no = 0;
30 return &no;
31 };
32 virtual const char* getCategoryGroupName(
33 const uint8_t* categoryEnabledFlag) SK_OVERRIDE {
34 static const char* dummy = "dummy";
35 return dummy;
36 };
37 };
39 SkEventTracer *SkEventTracer::gInstance;
41 static void intialiize_default_tracer(void *current_instance) {
42 if (NULL == current_instance) {
43 SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer));
44 }
45 }
47 static void cleanup_tracer() {
48 // calling SetInstance will delete the existing instance.
49 SkEventTracer::SetInstance(NULL);
50 }
52 SkEventTracer* SkEventTracer::GetInstance() {
53 SK_DECLARE_STATIC_ONCE(once);
54 SkOnce(&once,
55 intialiize_default_tracer,
56 SkEventTracer::gInstance,
57 cleanup_tracer);
58 SkASSERT(NULL != SkEventTracer::gInstance);
59 return SkEventTracer::gInstance;
60 }