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

Unified 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: Address Andrei's comments. 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/ios/Cronet.h
diff --git a/components/cronet/ios/Cronet.h b/components/cronet/ios/Cronet.h
index fc7b9c2486aa0573c1e3ce33264b8a67646e7390..d5be3eaa119968ece40300273acead10f4f91468 100644
--- a/components/cronet/ios/Cronet.h
+++ b/components/cronet/ios/Cronet.h
@@ -6,6 +6,10 @@
#include "cronet_c_for_grpc.h"
+// A block, that takes a request, and returns YES if the request should
+// be handled.
+typedef BOOL (^RequestFilterBlock)(NSURLRequest* request);
+
// Interface for installing Cronet.
CRONET_EXPORT
@interface Cronet : NSObject
@@ -32,6 +36,11 @@ CRONET_EXPORT
// captures. This method only has any effect before |start| is called.
+ (void)setSslKeyLogFileName:(NSString*)sslKeyLogFileName;
+// Set the block used to determine whether or not Cronet should handle the
+// request. If this is not set, Cronet will handle all requests.
+// This method only has any effect before |start| is called.
++ (void)setRequestFilterBlock:(RequestFilterBlock)block;
kapishnikov 2016/08/12 17:19:31 We should mention in the doc whether the method ke
mef 2016/08/26 14:58:07 Done. Changed it to reset block after start, so it
+
// Starts CronetEngine. It is recommended to call this method on the application
// main thread. If the method is called on any thread other than the main one,
// the method will internally try to execute synchronously using the main GCD
@@ -39,6 +48,25 @@ CRONET_EXPORT
// that calls this method; otherwise, a deadlock can occur.
+ (void)start;
+// Registers Cronet as HttpProtocol Handler. Once registered, Cronet intercepts
+// and handles all NSURLConnection and NSURLRequests issued by the app,
+// including requests done through shared NSURLSession.
+// This method must be called after |start|.
++ (void)registerHttpProtocolHandler;
+
+// Unregister Cronet as HttpProtocol Handler. This means that Cronet will stop
+// intercepting requests, however, it won't tear down the Cronet environment.
+// This method must be called after |start|.
++ (void)unregisterHttpProtocolHandler;
+
+// Installs Cronet into Cronet into NSURLSessionConfiguration so that all
kapishnikov 2016/08/12 17:19:31 Remove repeating "Cronet into"
mef 2016/08/26 14:58:07 Done.
+// NSURLSessions created with this configuration will use the Cronet stack.
+// Note that this NSURLSession will share Cronet settings with the
kapishnikov 2016/08/12 17:19:31 Maybe we should mention that Cronet settings are g
mef 2016/08/26 14:58:07 Done.
+// sharedSession,
+// which the |registerHttpProtocolHandler| method installs Cronet into.
+// This method must be called after |start|.
++ (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config;
+
// Starts net-internals logging to a file named |fileName| in the application
// temporary directory. |fileName| must not be empty. Log level is determined
// by |logBytes| - if YES then LOG_ALL otherwise LOG_ALL_BUT_BYTES. If the file
@@ -57,4 +85,14 @@ CRONET_EXPORT
// Get a pointer to global instance of cronet_engine for GRPC C API.
+ (cronet_engine*)getGlobalEngine;
+// Returns differences in metrics collected by Cronet since the last call to
+// getGlobalMetricsDeltas, serialized as a
+// <a href=https://developers.google.com/protocol-buffers>protobuf</a>.
+//
+// Cronet starts collecting these metrics after the first call to
+// getGlobalMetricsDeltras, so the first call returns no
+// useful data as no metrics have yet been collected.
+// differences in metrics collected by Cronet, since the last call
++ (NSData*)getGlobalMetricsDeltas;
+
@end

Powered by Google App Engine
This is Rietveld 408576698