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

Unified Diff: components/cronet/android/cronet_url_request_adapter.h

Issue 2351793003: Implement timing metrics for UrlRequest (Closed)
Patch Set: Small cleanups Created 4 years, 2 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/android/cronet_url_request_adapter.h
diff --git a/components/cronet/android/cronet_url_request_adapter.h b/components/cronet/android/cronet_url_request_adapter.h
index b8c2d102e4e2ff85138d01e5bc5ef0c65c8b001b..eb442c4caa1cc818a36c70fe32ba752960614c19 100644
--- a/components/cronet/android/cronet_url_request_adapter.h
+++ b/components/cronet/android/cronet_url_request_adapter.h
@@ -18,6 +18,7 @@
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/time/time.h"
#include "net/base/request_priority.h"
#include "net/url_request/url_request.h"
#include "url/gurl.h"
@@ -60,7 +61,8 @@ class CronetURLRequestAdapter : public net::URLRequest::Delegate {
const GURL& url,
net::RequestPriority priority,
jboolean jdisable_cache,
- jboolean jdisable_connection_migration);
+ jboolean jdisable_connection_migration,
+ jboolean jenable_metrics);
~CronetURLRequestAdapter() override;
// Methods called prior to Start are never called on network thread.
@@ -137,7 +139,9 @@ class CronetURLRequestAdapter : public net::URLRequest::Delegate {
void DestroyOnNetworkThread(bool send_on_canceled);
// Report error and cancel request_adapter.
- void ReportError(net::URLRequest* request, int net_error) const;
+ void ReportError(net::URLRequest* request, int net_error);
+ // Reports metrics collected to the Java layer
+ void MaybeReportMetrics(JNIEnv* env) const;
CronetURLRequestContextAdapter* context_;
@@ -154,6 +158,10 @@ class CronetURLRequestAdapter : public net::URLRequest::Delegate {
scoped_refptr<IOBufferWithByteBuffer> read_buffer_;
std::unique_ptr<net::URLRequest> url_request_;
+ // Whether detailed metrics should be collected and reported to Java for this
+ // request.
+ const bool enable_metrics_;
+
DISALLOW_COPY_AND_ASSIGN(CronetURLRequestAdapter);
};

Powered by Google App Engine
This is Rietveld 408576698