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 2010 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 #include "SkStream_NSData.h"
10 NSData* NSData_dataWithStream(SkStream* stream) {
11 size_t length = stream->getLength();
12 void* src = malloc(length);
13 size_t bytes = stream->read(src, length);
14 SkASSERT(bytes == length);
15 return [NSData dataWithBytesNoCopy:src length:length freeWhenDone:YES];
16 }
18 NSData* NSData_dataFromResource(const char cname[], const char csuffix[]) {
19 NSBundle* bundle = [NSBundle mainBundle];
20 NSString* name = [NSString stringWithUTF8String:cname];
21 NSString* suffix = [NSString stringWithUTF8String:csuffix];
22 NSString* path = [bundle pathForResource:name ofType:suffix];
23 return [NSData dataWithContentsOfMappedFile:path];
24 }
26 ///////////////////////////////////////////////////////////////////////////////
28 SkStream_NSData::SkStream_NSData(NSData* data) {
29 fNSData = data;
30 [fNSData retain];
32 this->setMemory([fNSData bytes], [fNSData length], false);
33 }
35 SkStream_NSData::~SkStream_NSData() {
36 [fNSData release];
37 }
39 SkStream_NSData* SkStream_NSData::CreateFromResource(const char name[],
40 const char suffix[]) {
41 NSData* data = NSData_dataFromResource(name, suffix);
42 return SkNEW_ARGS(SkStream_NSData, (data));
43 }