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

Unified Diff: chrome/browser/data_use_measurement/chrome_data_use_ascriber.h

Issue 2285903002: Framework to ascribe all network data use to a source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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: chrome/browser/data_use_measurement/chrome_data_use_ascriber.h
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_ascriber.h b/chrome/browser/data_use_measurement/chrome_data_use_ascriber.h
new file mode 100644
index 0000000000000000000000000000000000000000..339b85c9e3cea3ce7a0c9da4e6585d92880a619c
--- /dev/null
+++ b/chrome/browser/data_use_measurement/chrome_data_use_ascriber.h
@@ -0,0 +1,83 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_
+#define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_
+
+#include "base/macros.h"
+#include "components/data_use_measurement/core/data_use_ascriber.h"
+#include "net/base/layered_network_delegate.h"
Lei Zhang 2016/09/08 22:04:42 What's this for?
Not at Google. Contact bengr 2016/09/09 18:37:16 Done.
+#include "url/gurl.h"
+
+namespace content {
+class NavigationHandle;
+class RenderFrameHost;
+}
+
+namespace data_use_measurement {
Lei Zhang 2016/09/08 22:04:42 nit: blank line after when it's not fwrd decls.
Not at Google. Contact bengr 2016/09/09 18:37:16 Done.
+// Browser implementation of |DataUseAscriber|. Maintains a list of
Lei Zhang 2016/09/08 22:04:42 |variable_name|, Classes are written normally.
Not at Google. Contact bengr 2016/09/09 18:37:16 Done.
+// |DataUseRecorder| instances, one for each source of data, such as a page
+// load.
+//
+// A page includes all resources loaded in response to a main page navigation.
+// The scope of a page load ends either when the tab is closed or a new page
+// load is initiated by clicking on a link, entering a new URL, window location
+// change, etc
Lei Zhang 2016/09/08 22:04:42 End sentences with periods.
Not at Google. Contact bengr 2016/09/09 18:37:16 Done.
+//
+// For URLRequests initiated outside the context of a page load, such as
+// Service Workers, Chrome Services, etc, a new instance of |DataUseRecorder|
+// will be created for each |URLRequest|.
+//
+// Each page load will be associated with an instance of |DataUseRecorder|.
+// Each URLRequest initiated in the context of a page load will be mapped to
+// the |DataUseRecorder| instance for page load.
+//
+// This class lives entirely on the IO thread. It maintains a copy of frame and
+// navigation information on the IO thread.
+class ChromeDataUseAscriber : public DataUseAscriber {
+ public:
+ ChromeDataUseAscriber();
+
+ ~ChromeDataUseAscriber() override;
+
+ // Chrome override of |GetDataUseRecorder()|.
Lei Zhang 2016/09/08 22:04:42 This is not helpful. Just: // DataUseAscriber: [A
Not at Google. Contact bengr 2016/09/09 18:37:16 Done.
+ DataUseRecorder* GetDataUseRecorder(const net::URLRequest* request) override;
+
+ // Must be called on the IO thread when a render frame host is created.
Lei Zhang 2016/09/08 22:04:42 You can probably omit the "Must be called on the I
Not at Google. Contact bengr 2016/09/09 18:37:16 Done.
+ void RenderFrameCreated(int render_process_id,
+ int render_frame_id,
+ int parent_render_process_id,
+ int parent_render_frame_id);
+
+ // Must be called on the IO thread when a render frame host is deleted.
+ void RenderFrameDeleted(int render_process_id,
+ int render_frame_id,
+ int parent_render_process_id,
+ int parent_render_frame_id);
+
+ // Must be called on the IO thread when a main frame navigation is started.
+ void DidStartMainFrameNavigation(GURL gurl,
Lei Zhang 2016/09/08 22:04:42 Pass by const-ref, here and below?
Not at Google. Contact bengr 2016/09/09 18:37:16 Comes from a different thread, so cannot use ref.
+ int render_process_id,
+ int render_frame_id,
+ void* navigation_handle);
+
+ // Must be called on the IO thread when a main frame navigation is completed.
+ void DidFinishMainFrameNavigation(GURL gurl,
+ int render_process_id,
+ int render_frame_id,
+ bool is_same_page_navigation,
+ void* navigation_handle);
+
+ // Must be called on the IO thread when a main frame navigation is redirected.
+ void DidRedirectMainFrameNavigation(GURL gurl,
+ int render_process_id,
+ int render_frame_id,
+ void* navigation_handle);
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriber);
Lei Zhang 2016/09/08 22:04:42 DISALLOW_COPY_AND_ASSIGN() does no good if it's pu
Not at Google. Contact bengr 2016/09/09 18:37:16 Done.
+};
+
+} // namespace data_use_measurement
+
+#endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_H_

Powered by Google App Engine
This is Rietveld 408576698