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

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

Issue 2146643002: [Cronet] Integrate CrNet functionality into Cronet on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove prototype CronetEngine from this CL. Created 4 years, 4 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
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 <Foundation/Foundation.h> 5 #import <Foundation/Foundation.h>
6 6
7 #include "cronet_c_for_grpc.h" 7 #include "cronet_c_for_grpc.h"
8 8
9 // A block, that takes a request, and returns YES if the request should
10 // be handled.
11 typedef BOOL (^RequestFilterBlock)(NSURLRequest* request);
12
9 // Interface for installing Cronet. 13 // Interface for installing Cronet.
10 CRONET_EXPORT 14 CRONET_EXPORT
11 @interface Cronet : NSObject 15 @interface Cronet : NSObject
12 16
13 // Sets whether HTTP/2 should be supported by CronetEngine. This method only has 17 // Sets whether HTTP/2 should be supported by CronetEngine. This method only has
14 // any effect before |start| is called. 18 // any effect before |start| is called.
15 + (void)setHttp2Enabled:(BOOL)http2Enabled; 19 + (void)setHttp2Enabled:(BOOL)http2Enabled;
16 20
17 // Sets whether QUIC should be supported by CronetEngine. This method only has 21 // Sets whether QUIC should be supported by CronetEngine. This method only has
18 // any effect before |start| is called. 22 // any effect before |start| is called.
19 + (void)setQuicEnabled:(BOOL)quicEnabled; 23 + (void)setQuicEnabled:(BOOL)quicEnabled;
20 24
21 // Adds hint that host supports QUIC on altPort. This method only has any effect 25 // Adds hint that host supports QUIC on altPort. This method only has any effect
22 // before |start| is called. 26 // before |start| is called.
23 + (void)addQuicHint:(NSString*)host port:(int)port altPort:(int)altPort; 27 + (void)addQuicHint:(NSString*)host port:(int)port altPort:(int)altPort;
24 28
25 // |userAgent| is expected to be of the form Product/Version. 29 // |userAgent| is expected to be of the form Product/Version.
26 // Example: Foo/3.0.0.0 30 // Example: Foo/3.0.0.0
27 // 31 //
28 // This method only has any effect before |start| is called. 32 // This method only has any effect before |start| is called.
29 + (void)setPartialUserAgent:(NSString*)userAgent; 33 + (void)setPartialUserAgent:(NSString*)userAgent;
30 34
35 // This method only has any effect before |start| is called.
36 + (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting;
kapishnikov 2016/08/10 17:47:40 I wonder if we can somehow hide "...ForTesting" me
mef 2016/08/11 21:22:15 Great idea! I've extracted them into Cronet(TestSu
37
38 // Sets a native MockCertVerifier for testing.
39 // This method only has any effect before |start| is called.
40 + (void)setMockCertVerifierForTesting:(void*)mockCertVerifierForTesting;
41
31 // Sets SSLKEYLogFileName to export SSL key for Wireshark decryption of packet 42 // Sets SSLKEYLogFileName to export SSL key for Wireshark decryption of packet
32 // captures. This method only has any effect before |start| is called. 43 // captures. This method only has any effect before |start| is called.
33 + (void)setSslKeyLogFileName:(NSString*)sslKeyLogFileName; 44 + (void)setSslKeyLogFileName:(NSString*)sslKeyLogFileName;
34 45
46 // Set the block used to determine whether or not Cronet should handle the
47 // request. If this is not set, Cronet will handle all requests.
48 // This method only has any effect before |start| is called.
49 + (void)setRequestFilterBlock:(RequestFilterBlock)block;
50
35 // Starts CronetEngine. It is recommended to call this method on the application 51 // Starts CronetEngine. It is recommended to call this method on the application
36 // main thread. If the method is called on any thread other than the main one, 52 // main thread. If the method is called on any thread other than the main one,
37 // the method will internally try to execute synchronously using the main GCD 53 // the method will internally try to execute synchronously using the main GCD
38 // queue. Please make sure that the main thread is not blocked by a job 54 // queue. Please make sure that the main thread is not blocked by a job
39 // that calls this method; otherwise, a deadlock can occur. 55 // that calls this method; otherwise, a deadlock can occur.
40 + (void)start; 56 + (void)start;
41 57
58 // Registers Cronet as HttpProtocol Handler. Once registered, Cronet intercepts
59 // and handles all NSURLConnection and NSURLRequests issued by the app,
60 // including
61 // requests done through shared NSURLSession.
kapishnikov 2016/08/10 17:47:40 This can fit in the previous line.
mef 2016/08/11 21:22:15 Done.
62 // This method must be called after |start|.
63 + (void)registerHttpProtocolHandler;
64
65 // Unregister Cronet as HttpProtocol Handler. This means that Cronet will stop
66 // intercepting requests, however, it won't tear down the Cronet environment.
67 // This method must be called after |start|.
68 + (void)unregisterHttpProtocolHandler;
69
70 // Installs Croet into an NSURLSession, passed in by the caller. Note that this
kapishnikov 2016/08/10 17:47:40 Croer=>Cronet
mef 2016/08/11 21:22:15 Done.
71 // NSURLSession will share settings with the sharedSession, which the
kapishnikov 2016/08/10 17:47:40 The shared session has its own internal configurat
mef 2016/08/11 21:22:15 Done.
72 // |registerHttpProtocolHandler| method installs Cronet into.
73 // This method must be called after |start|.
74 + (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config;
75
42 // Starts net-internals logging to a file named |fileName| in the application 76 // Starts net-internals logging to a file named |fileName| in the application
43 // temporary directory. |fileName| must not be empty. Log level is determined 77 // temporary directory. |fileName| must not be empty. Log level is determined
44 // by |logBytes| - if YES then LOG_ALL otherwise LOG_ALL_BUT_BYTES. If the file 78 // by |logBytes| - if YES then LOG_ALL otherwise LOG_ALL_BUT_BYTES. If the file
45 // exists it is truncated before starting. If actively logging the call is 79 // exists it is truncated before starting. If actively logging the call is
46 // ignored. 80 // ignored.
47 + (void)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes; 81 + (void)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes;
48 82
49 // Stop net-internals logging and flush file to disk. If a logging session is 83 // Stop net-internals logging and flush file to disk. If a logging session is
50 // not in progress this call is ignored. 84 // not in progress this call is ignored.
51 + (void)stopNetLog; 85 + (void)stopNetLog;
52 86
53 // Returns the full user-agent that the stack uses. 87 // Returns the full user-agent that the stack uses.
54 // This is the exact string servers will see. 88 // This is the exact string servers will see.
55 + (NSString*)getUserAgent; 89 + (NSString*)getUserAgent;
56 90
57 // Get a pointer to global instance of cronet_engine for GRPC C API. 91 // Get a pointer to global instance of cronet_engine for GRPC C API.
58 + (cronet_engine*)getGlobalEngine; 92 + (cronet_engine*)getGlobalEngine;
59 93
94 // Returns differences in metrics collected by Cronet since the last call to
95 // getGlobalMetricsDeltas.
96 // Cronet starts collecting these metrics after the first call to
97 // getGlobalMetricsDeltras, so the first call returns no
98 // useful data as no metrics have yet been collected.
99 + (NSData*)getGlobalMetricsDeltas;
kapishnikov 2016/08/10 17:47:40 What is the structure of NSData? What should the u
mef 2016/08/11 21:22:15 Done.
100
60 @end 101 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698