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 2013 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 | #ifndef SkMutex_win_DEFINED |
michael@0 | 9 | #define SkMutex_win_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | /** Windows CriticalSection based mutex. */ |
michael@0 | 12 | |
michael@0 | 13 | #ifndef WIN32_LEAN_AND_MEAN |
michael@0 | 14 | # define WIN32_LEAN_AND_MEAN |
michael@0 | 15 | # define WIN32_IS_MEAN_WAS_LOCALLY_DEFINED |
michael@0 | 16 | #endif |
michael@0 | 17 | #ifndef NOMINMAX |
michael@0 | 18 | # define NOMINMAX |
michael@0 | 19 | # define NOMINMAX_WAS_LOCALLY_DEFINED |
michael@0 | 20 | #endif |
michael@0 | 21 | # |
michael@0 | 22 | #include <windows.h> |
michael@0 | 23 | # |
michael@0 | 24 | #ifdef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED |
michael@0 | 25 | # undef WIN32_IS_MEAN_WAS_LOCALLY_DEFINED |
michael@0 | 26 | # undef WIN32_LEAN_AND_MEAN |
michael@0 | 27 | #endif |
michael@0 | 28 | #ifdef NOMINMAX_WAS_LOCALLY_DEFINED |
michael@0 | 29 | # undef NOMINMAX_WAS_LOCALLY_DEFINED |
michael@0 | 30 | # undef NOMINMAX |
michael@0 | 31 | #endif |
michael@0 | 32 | |
michael@0 | 33 | // On Windows, SkBaseMutex and SkMutex are the same thing, |
michael@0 | 34 | // we can't easily get rid of static initializers. |
michael@0 | 35 | class SkMutex { |
michael@0 | 36 | public: |
michael@0 | 37 | SkMutex() { |
michael@0 | 38 | InitializeCriticalSection(&fStorage); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | ~SkMutex() { |
michael@0 | 42 | DeleteCriticalSection(&fStorage); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | void acquire() { |
michael@0 | 46 | EnterCriticalSection(&fStorage); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | void release() { |
michael@0 | 50 | LeaveCriticalSection(&fStorage); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | private: |
michael@0 | 54 | SkMutex(const SkMutex&); |
michael@0 | 55 | SkMutex& operator=(const SkMutex&); |
michael@0 | 56 | |
michael@0 | 57 | CRITICAL_SECTION fStorage; |
michael@0 | 58 | }; |
michael@0 | 59 | |
michael@0 | 60 | typedef SkMutex SkBaseMutex; |
michael@0 | 61 | |
michael@0 | 62 | // Windows currently provides no documented means of POD initializing a CRITICAL_SECTION. |
michael@0 | 63 | #define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name |
michael@0 | 64 | #define SK_DECLARE_GLOBAL_MUTEX(name) SkBaseMutex name |
michael@0 | 65 | |
michael@0 | 66 | #endif |