Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Side by Side Diff: components/cronet/ios/Cronet.mm

Issue 2465303002: [cronet] make startNetLogToFile write to correct file (Closed)
Patch Set: sync Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/cronet/ios/Cronet.h ('k') | components/cronet/ios/cronet_environment.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "components/cronet/ios/Cronet.h" 5 #import "components/cronet/ios/Cronet.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 [NSURLCache setSharedURLCache:gPreservedSharedURLCache]; 223 [NSURLCache setSharedURLCache:gPreservedSharedURLCache];
224 gPreservedSharedURLCache = nil; 224 gPreservedSharedURLCache = nil;
225 } 225 }
226 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]]; 226 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]];
227 } 227 }
228 228
229 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config { 229 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config {
230 config.protocolClasses = @[ [CRNPauseableHTTPProtocolHandler class] ]; 230 config.protocolClasses = @[ [CRNPauseableHTTPProtocolHandler class] ];
231 } 231 }
232 232
233 + (void)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes { 233 + (NSString*)getNetLogPathForFile:(NSString*)fileName {
234 if (gChromeNet.Get().get() && [fileName length]) { 234 return [[[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory
235 gChromeNet.Get()->StartNetLog([fileName UTF8String], logBytes); 235 inDomains:NSUserDomainMask]
236 lastObject] URLByAppendingPathComponent:fileName] path];
237 }
238
239 + (BOOL)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes {
240 if (gChromeNet.Get().get() && [fileName length] &&
241 ![fileName isAbsolutePath]) {
242 return gChromeNet.Get()->StartNetLog(
243 base::SysNSStringToUTF8([self getNetLogPathForFile:fileName]),
244 logBytes);
236 } 245 }
246
247 return NO;
237 } 248 }
238 249
239 + (void)stopNetLog { 250 + (void)stopNetLog {
240 if (gChromeNet.Get().get()) { 251 if (gChromeNet.Get().get()) {
241 gChromeNet.Get()->StopNetLog(); 252 gChromeNet.Get()->StopNetLog();
242 } 253 }
243 } 254 }
244 255
245 + (NSString*)getUserAgent { 256 + (NSString*)getUserAgent {
246 if (!gChromeNet.Get().get()) { 257 if (!gChromeNet.Get().get()) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 base::SysNSStringToUTF8(hostResolverRulesForTesting)); 290 base::SysNSStringToUTF8(hostResolverRulesForTesting));
280 } 291 }
281 292
282 // This is a non-public dummy method that prevents the linker from stripping out 293 // This is a non-public dummy method that prevents the linker from stripping out
283 // the otherwise non-referenced methods from 'bidirectional_stream.cc'. 294 // the otherwise non-referenced methods from 'bidirectional_stream.cc'.
284 + (void)preventStrippingCronetBidirectionalStream { 295 + (void)preventStrippingCronetBidirectionalStream {
285 bidirectional_stream_create(NULL, 0, 0); 296 bidirectional_stream_create(NULL, 0, 0);
286 } 297 }
287 298
288 @end 299 @end
OLDNEW
« no previous file with comments | « components/cronet/ios/Cronet.h ('k') | components/cronet/ios/cronet_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698