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.
2 /*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
10 #include "GrResource.h"
11 #include "GrGpu.h"
13 GrResource::GrResource(GrGpu* gpu, bool isWrapped) {
14 fGpu = gpu;
15 fCacheEntry = NULL;
16 fDeferredRefCount = 0;
17 if (isWrapped) {
18 fFlags = kWrapped_FlagBit;
19 } else {
20 fFlags = 0;
21 }
22 fGpu->insertResource(this);
23 }
25 GrResource::~GrResource() {
26 // subclass should have released this.
27 SkASSERT(0 == fDeferredRefCount);
28 SkASSERT(!this->isValid());
29 }
31 void GrResource::release() {
32 if (NULL != fGpu) {
33 this->onRelease();
34 fGpu->removeResource(this);
35 fGpu = NULL;
36 }
37 }
39 void GrResource::abandon() {
40 if (NULL != fGpu) {
41 this->onAbandon();
42 fGpu->removeResource(this);
43 fGpu = NULL;
44 }
45 }
47 const GrContext* GrResource::getContext() const {
48 if (NULL != fGpu) {
49 return fGpu->getContext();
50 } else {
51 return NULL;
52 }
53 }
55 GrContext* GrResource::getContext() {
56 if (NULL != fGpu) {
57 return fGpu->getContext();
58 } else {
59 return NULL;
60 }
61 }