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 #ifndef SkImageRef_GlobalPool_DEFINED
11 #define SkImageRef_GlobalPool_DEFINED
13 #include "SkImageRef.h"
15 class SkImageRef_GlobalPool : public SkImageRef {
16 public:
17 // if pool is null, use the global pool
18 SkImageRef_GlobalPool(const SkImageInfo&, SkStreamRewindable*,
19 int sampleSize = 1);
20 virtual ~SkImageRef_GlobalPool();
22 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_GlobalPool)
24 // API to control the global pool
26 /** Return the amount specified as the budget for the cache (in bytes).
27 */
28 static size_t GetRAMBudget();
30 /** Set a new budget value for the cache.
31 */
32 static void SetRAMBudget(size_t);
34 /** Return how much ram is currently in use by the global cache.
35 */
36 static size_t GetRAMUsed();
38 /** Free up (approximately) enough such that the amount used by the cache
39 is <= the specified amount. Since some images may be "in use", the
40 amount actually freed may not always result in a ram usage value <=
41 to the requested amount. In addition, because of the
42 chunky nature of the cache, the resulting usage may be < the requested
43 amount.
44 */
45 static void SetRAMUsed(size_t usageInBytes);
47 static void DumpPool();
49 protected:
50 virtual bool onDecode(SkImageDecoder* codec, SkStreamRewindable* stream,
51 SkBitmap* bitmap, SkBitmap::Config config,
52 SkImageDecoder::Mode mode);
54 virtual void onUnlockPixels();
56 SkImageRef_GlobalPool(SkReadBuffer&);
58 private:
59 typedef SkImageRef INHERITED;
60 };
62 #endif