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 2008 The Android Open Source Project
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 "SkPageFlipper.h"
12 SkPageFlipper::SkPageFlipper() {
13 fWidth = 0;
14 fHeight = 0;
15 fDirty0 = &fDirty0Storage;
16 fDirty1 = &fDirty1Storage;
18 fDirty0->setEmpty();
19 fDirty1->setEmpty();
20 }
22 SkPageFlipper::SkPageFlipper(int width, int height) {
23 fWidth = width;
24 fHeight = height;
25 fDirty0 = &fDirty0Storage;
26 fDirty1 = &fDirty1Storage;
28 fDirty0->setRect(0, 0, width, height);
29 fDirty1->setEmpty();
30 }
32 void SkPageFlipper::resize(int width, int height) {
33 fWidth = width;
34 fHeight = height;
36 // this is the opposite of the constructors
37 fDirty1->setRect(0, 0, width, height);
38 fDirty0->setEmpty();
39 }
41 void SkPageFlipper::inval() {
42 fDirty1->setRect(0, 0, fWidth, fHeight);
43 }
45 void SkPageFlipper::inval(const SkIRect& rect) {
46 SkIRect r;
47 r.set(0, 0, fWidth, fHeight);
48 if (r.intersect(rect)) {
49 fDirty1->op(r, SkRegion::kUnion_Op);
50 }
51 }
53 void SkPageFlipper::inval(const SkRegion& rgn) {
54 SkRegion r;
55 r.setRect(0, 0, fWidth, fHeight);
56 if (r.op(rgn, SkRegion::kIntersect_Op)) {
57 fDirty1->op(r, SkRegion::kUnion_Op);
58 }
59 }
61 void SkPageFlipper::inval(const SkRect& rect, bool antialias) {
62 SkIRect r;
63 rect.round(&r);
64 if (antialias) {
65 r.inset(-1, -1);
66 }
67 this->inval(r);
68 }
70 const SkRegion& SkPageFlipper::update(SkRegion* copyBits) {
71 // Copy over anything new from page0 that isn't dirty in page1
72 copyBits->op(*fDirty0, *fDirty1, SkRegion::kDifference_Op);
73 SkTSwap<SkRegion*>(fDirty0, fDirty1);
74 fDirty1->setEmpty();
75 return *fDirty0;
76 }