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

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

Issue 2351793003: Implement timing metrics for UrlRequest (Closed)
Patch Set: add more testing, and other comments Created 4 years, 3 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 66a7620a5124caddc5da3bf583f9f11300deb839..e3dbdb9e3591186f364371e836a371222f4fb8f6 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.
@@ -139,6 +141,11 @@ class CronetURLRequestAdapter : public net::URLRequest::Delegate {
// Checks status of the request_adapter, return false if |is_success()| is
// true, otherwise report error and cancel request_adapter.
bool MaybeReportError(net::URLRequest* request) const;
+ // Reports metrics collected to the Java layer
+ void MaybeReportMetrics(net::URLRequest* request) const;
+ int64_t ConvertTime(base::TimeTicks ticks,
xunjieli 2016/09/20 21:53:33 nit: add a documentation for this method. optiona
mgersh 2016/09/30 23:47:14 Done.
+ base::Time start_time,
+ base::TimeTicks start_ticks) const;
CronetURLRequestContextAdapter* context_;
@@ -155,6 +162,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.
+ bool enable_metrics_;
xunjieli 2016/09/22 18:28:59 const bool.
mgersh 2016/09/30 23:47:14 Done.
+
DISALLOW_COPY_AND_ASSIGN(CronetURLRequestAdapter);
};

Powered by Google App Engine
This is Rietveld 408576698