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.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2012 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 "SkImage_Base.h" |
michael@0 | 9 | #include "SkImagePriv.h" |
michael@0 | 10 | #include "SkPicture.h" |
michael@0 | 11 | |
michael@0 | 12 | class SkImage_Picture : public SkImage_Base { |
michael@0 | 13 | public: |
michael@0 | 14 | SkImage_Picture(SkPicture*); |
michael@0 | 15 | virtual ~SkImage_Picture(); |
michael@0 | 16 | |
michael@0 | 17 | virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRIDE; |
michael@0 | 18 | virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) SK_OVERRIDE; |
michael@0 | 19 | |
michael@0 | 20 | SkPicture* getPicture() { return fPicture; } |
michael@0 | 21 | |
michael@0 | 22 | private: |
michael@0 | 23 | SkPicture* fPicture; |
michael@0 | 24 | |
michael@0 | 25 | typedef SkImage_Base INHERITED; |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 29 | |
michael@0 | 30 | SkImage_Picture::SkImage_Picture(SkPicture* pict) : INHERITED(pict->width(), pict->height()) { |
michael@0 | 31 | pict->endRecording(); |
michael@0 | 32 | pict->ref(); |
michael@0 | 33 | fPicture = pict; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | SkImage_Picture::~SkImage_Picture() { |
michael@0 | 37 | fPicture->unref(); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | void SkImage_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
michael@0 | 41 | const SkPaint* paint) { |
michael@0 | 42 | SkImagePrivDrawPicture(canvas, fPicture, x, y, paint); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | void SkImage_Picture::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst, |
michael@0 | 46 | const SkPaint* paint) { |
michael@0 | 47 | SkImagePrivDrawPicture(canvas, fPicture, src, dst, paint); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | SkImage* SkNewImageFromPicture(const SkPicture* srcPicture) { |
michael@0 | 51 | /** |
michael@0 | 52 | * We want to snapshot the playback status of the picture, w/o affecting |
michael@0 | 53 | * its ability to continue recording (if needed). |
michael@0 | 54 | * |
michael@0 | 55 | * Optimally this will shared as much data/buffers as it can with |
michael@0 | 56 | * srcPicture, and srcPicture will perform a copy-on-write as needed if it |
michael@0 | 57 | * needs to mutate them later on. |
michael@0 | 58 | */ |
michael@0 | 59 | SkAutoTUnref<SkPicture> playback(SkNEW_ARGS(SkPicture, (*srcPicture))); |
michael@0 | 60 | |
michael@0 | 61 | return SkNEW_ARGS(SkImage_Picture, (playback)); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | SkPicture* SkPictureImageGetPicture(SkImage* pictureImage) { |
michael@0 | 65 | return static_cast<SkImage_Picture*>(pictureImage)->getPicture(); |
michael@0 | 66 | } |