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 #ifndef SkRefDict_DEFINED
11 #define SkRefDict_DEFINED
13 #include "SkRefCnt.h"
15 /**
16 * A dictionary of string,refcnt pairs. The dictionary is also an owner of the
17 * refcnt objects while they are contained.
18 */
19 class SK_API SkRefDict : SkNoncopyable {
20 public:
21 SkRefDict();
22 ~SkRefDict();
24 /**
25 * Return the data associated with name[], or NULL if no matching entry
26 * is found. The reference-count of the entry is not affected.
27 */
28 SkRefCnt* find(const char name[]) const;
30 /**
31 * If data is NULL, remove (if present) the entry matching name and call
32 * prev_data->unref() on the data for the matching entry.
33 * If data is not-NULL, replace the existing entry matching name and
34 * call (prev_data->unref()), or add a new one. In either case,
35 * data->ref() is called.
36 */
37 void set(const char name[], SkRefCnt* data);
39 /**
40 * Remove the matching entry (if found) and unref its data.
41 */
42 void remove(const char name[]) { this->set(name, NULL); }
44 /**
45 * Remove all entries, and unref() their associated data.
46 */
47 void removeAll();
49 private:
50 struct Impl;
51 Impl* fImpl;
52 };
54 #endif