| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 + (NSString*)getUserAgent { | 248 + (NSString*)getUserAgent { |
| 249 if (!gChromeNet.Get().get()) { | 249 if (!gChromeNet.Get().get()) { |
| 250 return nil; | 250 return nil; |
| 251 } | 251 } |
| 252 | 252 |
| 253 return [NSString stringWithCString:gChromeNet.Get()->user_agent().c_str() | 253 return [NSString stringWithCString:gChromeNet.Get()->user_agent().c_str() |
| 254 encoding:[NSString defaultCStringEncoding]]; | 254 encoding:[NSString defaultCStringEncoding]]; |
| 255 } | 255 } |
| 256 | 256 |
| 257 + (cronet_engine*)getGlobalEngine { | 257 + (stream_engine*)getGlobalEngine { |
| 258 DCHECK(gChromeNet.Get().get()); | 258 DCHECK(gChromeNet.Get().get()); |
| 259 if (gChromeNet.Get().get()) { | 259 if (gChromeNet.Get().get()) { |
| 260 static cronet_engine engine; | 260 static stream_engine engine; |
| 261 engine.obj = gChromeNet.Get().get(); | 261 engine.obj = gChromeNet.Get()->GetURLRequestContextGetter(); |
| 262 return &engine; | 262 return &engine; |
| 263 } | 263 } |
| 264 return nil; | 264 return nil; |
| 265 } | 265 } |
| 266 | 266 |
| 267 + (NSData*)getGlobalMetricsDeltas { | 267 + (NSData*)getGlobalMetricsDeltas { |
| 268 if (!gChromeNet.Get().get()) { | 268 if (!gChromeNet.Get().get()) { |
| 269 return nil; | 269 return nil; |
| 270 } | 270 } |
| 271 std::vector<uint8_t> deltas(gChromeNet.Get()->GetHistogramDeltas()); | 271 std::vector<uint8_t> deltas(gChromeNet.Get()->GetHistogramDeltas()); |
| 272 return [NSData dataWithBytes:deltas.data() length:deltas.size()]; | 272 return [NSData dataWithBytes:deltas.data() length:deltas.size()]; |
| 273 } | 273 } |
| 274 | 274 |
| 275 + (void)enableTestCertVerifierForTesting { | 275 + (void)enableTestCertVerifierForTesting { |
| 276 gEnableTestCertVerifierForTesting = YES; | 276 gEnableTestCertVerifierForTesting = YES; |
| 277 } | 277 } |
| 278 | 278 |
| 279 + (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting { | 279 + (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting { |
| 280 gHostResolverRulesForTesting = hostResolverRulesForTesting; | 280 gHostResolverRulesForTesting = hostResolverRulesForTesting; |
| 281 } | 281 } |
| 282 | 282 |
| 283 // This is a non-public dummy method that prevents the linker from stripping out | 283 // 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'. | 284 // the otherwise non-referenced methods from 'bidirectional_stream.cc'. |
| 285 + (void)preventStrippingCronetBidirectionalStream { | 285 + (void)preventStrippingCronetBidirectionalStream { |
| 286 cronet_bidirectional_stream_create(NULL, 0, 0); | 286 bidirectional_stream_create(NULL, 0, 0); |
| 287 } | 287 } |
| 288 | 288 |
| 289 @end | 289 @end |
| OLD | NEW |