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 "SkBitmap.h" |
michael@0 | 11 | #include "SkCanvas.h" |
michael@0 | 12 | #include "GrContext.h" |
michael@0 | 13 | #include "GrTexture.h" |
michael@0 | 14 | #include "SkGrPixelRef.h" |
michael@0 | 15 | |
michael@0 | 16 | class SkImage_Gpu : public SkImage_Base { |
michael@0 | 17 | public: |
michael@0 | 18 | SK_DECLARE_INST_COUNT(SkImage_Gpu) |
michael@0 | 19 | |
michael@0 | 20 | explicit SkImage_Gpu(const SkBitmap&); |
michael@0 | 21 | virtual ~SkImage_Gpu(); |
michael@0 | 22 | |
michael@0 | 23 | virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OVERRIDE; |
michael@0 | 24 | virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint*) SK_OVERRIDE; |
michael@0 | 25 | virtual GrTexture* onGetTexture() SK_OVERRIDE; |
michael@0 | 26 | virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE; |
michael@0 | 27 | |
michael@0 | 28 | GrTexture* getTexture() { return fBitmap.getTexture(); } |
michael@0 | 29 | |
michael@0 | 30 | private: |
michael@0 | 31 | SkBitmap fBitmap; |
michael@0 | 32 | |
michael@0 | 33 | typedef SkImage_Base INHERITED; |
michael@0 | 34 | }; |
michael@0 | 35 | |
michael@0 | 36 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 37 | |
michael@0 | 38 | SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap) |
michael@0 | 39 | : INHERITED(bitmap.width(), bitmap.height()) |
michael@0 | 40 | , fBitmap(bitmap) { |
michael@0 | 41 | SkASSERT(NULL != fBitmap.getTexture()); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | SkImage_Gpu::~SkImage_Gpu() { |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
michael@0 | 48 | const SkPaint* paint) { |
michael@0 | 49 | canvas->drawBitmap(fBitmap, x, y, paint); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | void SkImage_Gpu::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst, |
michael@0 | 53 | const SkPaint* paint) { |
michael@0 | 54 | canvas->drawBitmapRectToRect(fBitmap, src, dst, paint); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | GrTexture* SkImage_Gpu::onGetTexture() { |
michael@0 | 58 | return fBitmap.getTexture(); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | bool SkImage_Gpu::getROPixels(SkBitmap* dst) const { |
michael@0 | 62 | return fBitmap.copyTo(dst, kPMColor_SkColorType); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 66 | |
michael@0 | 67 | SkImage* SkImage::NewTexture(const SkBitmap& bitmap) { |
michael@0 | 68 | if (NULL == bitmap.getTexture()) { |
michael@0 | 69 | return NULL; |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | return SkNEW_ARGS(SkImage_Gpu, (bitmap)); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | GrTexture* SkTextureImageGetTexture(SkImage* image) { |
michael@0 | 76 | return ((SkImage_Gpu*)image)->getTexture(); |
michael@0 | 77 | } |