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

Side by Side Diff: chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h

Issue 2534023002: Create a DataUseRecorder instance for each page load in Chrome. (Closed)
Patch Set: Use emplace to insert; remove copy constructor Created 4 years 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 #ifndef CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_ 5 #ifndef CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_
6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_ 6 #define CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // Called when a navigation is started. Propagates main frame navigation 46 // Called when a navigation is started. Propagates main frame navigation
47 // start to the |ascriber_| on the IO thread. NavigationHandle methods 47 // start to the |ascriber_| on the IO thread. NavigationHandle methods
48 // cannot be called on the IO thread, so the pointer is cast to void*. 48 // cannot be called on the IO thread, so the pointer is cast to void*.
49 void DidStartNavigation(content::NavigationHandle* navigation_handle); 49 void DidStartNavigation(content::NavigationHandle* navigation_handle);
50 50
51 // Called when the navigation is ready to be committed in a renderer. 51 // Called when the navigation is ready to be committed in a renderer.
52 // Propagates the event to the |ascriber_| on the IO thread. NavigationHandle 52 // Propagates the event to the |ascriber_| on the IO thread. NavigationHandle
53 // methods cannot be called on the IO thread, so the pointer is cast to void*. 53 // methods cannot be called on the IO thread, so the pointer is cast to void*.
54 void ReadyToCommitNavigation(content::NavigationHandle* navigation_handle); 54 void ReadyToCommitNavigation(content::NavigationHandle* navigation_handle);
55 55
56 // Called when a navigation is redirected. Propagates main frame navigation
57 // redirect to the |ascriber_| on the IO thread. NavigationHandle methods
58 // cannot be called on the IO thread, so the pointer is cast to void*.
59 void DidRedirectNavigation(content::NavigationHandle* navigation_handle);
60
61 private: 56 private:
62 friend class ChromeDataUseAscriberServiceTest; 57 friend class ChromeDataUseAscriberServiceTest;
63 58
64 void SetDataUseAscriber(ChromeDataUseAscriber* ascriber); 59 void SetDataUseAscriber(ChromeDataUseAscriber* ascriber);
65 60
66 // |ascriber_| outlives this instance. 61 // |ascriber_| outlives this instance.
67 ChromeDataUseAscriber* ascriber_; 62 ChromeDataUseAscriber* ascriber_;
68 63
69 // Tracks whether |ascriber_| was set. This field is required because tests 64 // Tracks whether |ascriber_| was set. This field is required because tests
70 // might set |ascriber_| to nullptr. 65 // might set |ascriber_| to nullptr.
71 bool is_initialized_; 66 bool is_initialized_;
72 67
73 // Frame events might arrive from the UI thread before |ascriber_| is set. A 68 // Frame events might arrive from the UI thread before |ascriber_| is set. A
74 // queue of frame events that arrive before |ascriber_| is set is maintained 69 // queue of frame events that arrive before |ascriber_| is set is maintained
75 // in this field so that they can be propagated immediately after |ascriber_| 70 // in this field so that they can be propagated immediately after |ascriber_|
76 // is set. The RenderFrameHost pointers in the queues are valid for the 71 // is set. The RenderFrameHost pointers in the queues are valid for the
77 // duration that they are in the queue. 72 // duration that they are in the queue.
78 std::list<content::RenderFrameHost*> pending_frames_queue_; 73 std::list<content::RenderFrameHost*> pending_frames_queue_;
79 74
80 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriberService); 75 DISALLOW_COPY_AND_ASSIGN(ChromeDataUseAscriberService);
81 }; 76 };
82 77
83 } // namespace data_use_measurement 78 } // namespace data_use_measurement
84 79
85 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_ H_ 80 #endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_CHROME_DATA_USE_ASCRIBER_SERVICE_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698