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 | /* |
michael@0 | 3 | * Copyright 2012 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | #include "SkPaintOptionsAndroid.h" |
michael@0 | 10 | #include "SkReadBuffer.h" |
michael@0 | 11 | #include "SkWriteBuffer.h" |
michael@0 | 12 | #include "SkTDict.h" |
michael@0 | 13 | #include "SkThread.h" |
michael@0 | 14 | #include <cstring> |
michael@0 | 15 | |
michael@0 | 16 | SkLanguage SkLanguage::getParent() const { |
michael@0 | 17 | SkASSERT(!fTag.isEmpty()); |
michael@0 | 18 | const char* tag = fTag.c_str(); |
michael@0 | 19 | |
michael@0 | 20 | // strip off the rightmost "-.*" |
michael@0 | 21 | const char* parentTagEnd = strrchr(tag, '-'); |
michael@0 | 22 | if (parentTagEnd == NULL) { |
michael@0 | 23 | return SkLanguage(); |
michael@0 | 24 | } |
michael@0 | 25 | size_t parentTagLen = parentTagEnd - tag; |
michael@0 | 26 | return SkLanguage(tag, parentTagLen); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | void SkPaintOptionsAndroid::flatten(SkWriteBuffer& buffer) const { |
michael@0 | 30 | buffer.writeUInt(fFontVariant); |
michael@0 | 31 | buffer.writeString(fLanguage.getTag().c_str()); |
michael@0 | 32 | buffer.writeBool(fUseFontFallbacks); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | void SkPaintOptionsAndroid::unflatten(SkReadBuffer& buffer) { |
michael@0 | 36 | fFontVariant = (FontVariant)buffer.readUInt(); |
michael@0 | 37 | SkString tag; |
michael@0 | 38 | buffer.readString(&tag); |
michael@0 | 39 | fLanguage = SkLanguage(tag); |
michael@0 | 40 | fUseFontFallbacks = buffer.readBool(); |
michael@0 | 41 | } |