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.
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
8 #ifndef SkMutex_win_DEFINED
9 #define SkMutex_win_DEFINED
11 /** Windows CriticalSection based mutex. */
13 #ifndef WIN32_LEAN_AND_MEAN
14 # define WIN32_LEAN_AND_MEAN
15 # define WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
16 #endif
17 #ifndef NOMINMAX
18 # define NOMINMAX
19 # define NOMINMAX_WAS_LOCALLY_DEFINED
20 #endif
21 #
22 #include <windows.h>
23 #
24 #ifdef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
25 # undef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
26 # undef WIN32_LEAN_AND_MEAN
27 #endif
28 #ifdef NOMINMAX_WAS_LOCALLY_DEFINED
29 # undef NOMINMAX_WAS_LOCALLY_DEFINED
30 # undef NOMINMAX
31 #endif
33 // On Windows, SkBaseMutex and SkMutex are the same thing,
34 // we can't easily get rid of static initializers.
35 class SkMutex {
36 public:
37 SkMutex() {
38 InitializeCriticalSection(&fStorage);
39 }
41 ~SkMutex() {
42 DeleteCriticalSection(&fStorage);
43 }
45 void acquire() {
46 EnterCriticalSection(&fStorage);
47 }
49 void release() {
50 LeaveCriticalSection(&fStorage);
51 }
53 private:
54 SkMutex(const SkMutex&);
55 SkMutex& operator=(const SkMutex&);
57 CRITICAL_SECTION fStorage;
58 };
60 typedef SkMutex SkBaseMutex;
62 // Windows currently provides no documented means of POD initializing a CRITICAL_SECTION.
63 #define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name
64 #define SK_DECLARE_GLOBAL_MUTEX(name) SkBaseMutex name
66 #endif