Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 [NSURLCache setSharedURLCache:gPreservedSharedURLCache]; | 226 [NSURLCache setSharedURLCache:gPreservedSharedURLCache]; |
| 227 gPreservedSharedURLCache = nil; | 227 gPreservedSharedURLCache = nil; |
| 228 } | 228 } |
| 229 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]]; | 229 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]]; |
| 230 } | 230 } |
| 231 | 231 |
| 232 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config { | 232 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config { |
| 233 config.protocolClasses = @[ [CRNPauseableHTTPProtocolHandler class] ]; | 233 config.protocolClasses = @[ [CRNPauseableHTTPProtocolHandler class] ]; |
| 234 } | 234 } |
| 235 | 235 |
| 236 + (void)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes { | 236 + (BOOL)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes { |
| 237 if (gChromeNet.Get().get() && [fileName length]) { | 237 if (gChromeNet.Get().get() && [fileName length]) { |
| 238 gChromeNet.Get()->StartNetLog([fileName UTF8String], logBytes); | 238 NSURL* file = |
| 239 [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory | |
| 240 inDomains:NSUserDomainMask] | |
| 241 lastObject] URLByAppendingPathComponent:fileName]; | |
|
kapishnikov
2016/11/18 22:17:27
The documentation of the method implies that absol
lilyhoughton
2016/11/22 20:48:42
This is a documentation error. (Absolute path is
| |
| 242 return gChromeNet.Get()->StartNetLog(base::SysNSStringToUTF8([file path]), | |
| 243 logBytes); | |
| 239 } | 244 } |
| 245 | |
| 246 return NO; | |
| 240 } | 247 } |
| 241 | 248 |
| 242 + (void)stopNetLog { | 249 + (void)stopNetLog { |
| 243 if (gChromeNet.Get().get()) { | 250 if (gChromeNet.Get().get()) { |
| 244 gChromeNet.Get()->StopNetLog(); | 251 gChromeNet.Get()->StopNetLog(); |
| 245 } | 252 } |
| 246 } | 253 } |
| 247 | 254 |
| 248 + (NSString*)getUserAgent { | 255 + (NSString*)getUserAgent { |
| 249 if (!gChromeNet.Get().get()) { | 256 if (!gChromeNet.Get().get()) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 280 gHostResolverRulesForTesting = hostResolverRulesForTesting; | 287 gHostResolverRulesForTesting = hostResolverRulesForTesting; |
| 281 } | 288 } |
| 282 | 289 |
| 283 // This is a non-public dummy method that prevents the linker from stripping out | 290 // This is a non-public dummy method that prevents the linker from stripping out |
| 284 // the otherwise non-referenced methods from 'cronet_bidirectional_stream.cc'. | 291 // the otherwise non-referenced methods from 'cronet_bidirectional_stream.cc'. |
| 285 + (void)preventStrippingCronetBidirectionalStream { | 292 + (void)preventStrippingCronetBidirectionalStream { |
| 286 cronet_bidirectional_stream_create(NULL, 0, 0); | 293 cronet_bidirectional_stream_create(NULL, 0, 0); |
| 287 } | 294 } |
| 288 | 295 |
| 289 @end | 296 @end |
| OLD | NEW |