Chromium Code Reviews| Index: chrome/browser/android/data_usage/data_use_tab_model.h |
| diff --git a/chrome/browser/android/data_usage/data_use_tab_model.h b/chrome/browser/android/data_usage/data_use_tab_model.h |
| index d1680993d81c0044c69aae61ff4c97c888e62548..a6ada48050d2437c7c11931c4615e23fee1d677c 100644 |
| --- a/chrome/browser/android/data_usage/data_use_tab_model.h |
| +++ b/chrome/browser/android/data_usage/data_use_tab_model.h |
| @@ -21,20 +21,19 @@ |
| #include "base/time/time.h" |
| #include "chrome/browser/android/data_usage/tab_data_use_entry.h" |
| #include "components/sessions/core/session_id.h" |
| +#include "url/gurl.h" |
| namespace base { |
| class SingleThreadTaskRunner; |
| class TickClock; |
| } |
| -class GURL; |
| - |
| namespace chrome { |
| namespace android { |
| class DataUseMatcher; |
| -class ExternalDataUseObserver; |
| +class ExternalDataUseObserverBridge; |
| // Models tracking and labeling of data usage within each Tab. Within each tab, |
| // the model tracks the data use of a sequence of navigations in a "tracking |
| @@ -85,11 +84,10 @@ class DataUseTabModel { |
| DataUseTabModel(); |
| - // Initializes |this| on UI thread. |external_data_use_observer| is the weak |
| - // pointer to ExternalDataUseObserver object that owns |this|. |
| + // Initializes |this| on UI thread. |external_data_use_observer_bridge| is the |
| + // pointer to ExternalDataUseObserverBridge object. |
|
tbansal1
2016/03/08 18:15:01
say more about ownership and lifetime: It seems th
Raj
2016/03/09 02:27:35
Done.
|
| void InitOnUIThread( |
| - const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| - const base::WeakPtr<ExternalDataUseObserver>& external_data_use_observer); |
| + const ExternalDataUseObserverBridge* external_data_use_observer_bridge); |
| virtual ~DataUseTabModel(); |
| @@ -196,6 +194,14 @@ class DataUseTabModel { |
| typedef base::hash_map<SessionID::id_type, TabDataUseEntry> TabEntryMap; |
| + // Contains the details of a single UI navigation event. |
| + struct DataUseUINavigationBuffer { |
|
tbansal1
2016/03/08 18:15:00
This name seems incorrect. This is not a buffer/co
|
| + SessionID::id_type tab_id; |
| + TransitionType transition; |
|
tbansal1
2016/03/08 18:15:01
s/transition/transition_type/
|
| + GURL url; |
| + std::string package; |
|
tbansal1
2016/03/08 18:15:01
nit: may be add comments for the fields. e.g., is
|
| + }; |
| + |
| // Gets the current label of a tab, and the new label if a navigation event |
| // occurs in the tab. |tab_id| is the source tab of the generated event, |
| // |transition| indicates the type of the UI event/transition, |url| is the |
| @@ -231,6 +237,8 @@ class DataUseTabModel { |
| // size is |kMaxTabEntries|. |
| void CompactTabEntries(); |
| + void ProcessBufferedNavigationEvents(); |
|
tbansal1
2016/03/08 18:15:01
function comments.
|
| + |
| // Collection of observers that receive tracking session start and end |
| // notifications. Notifications are posted on UI thread. |
| base::ObserverList<TabDataUseObserver> observers_; |
| @@ -258,6 +266,12 @@ class DataUseTabModel { |
| // True if the external control app is installed. |
| bool is_control_app_installed_; |
| + // Buffers the list of UI navigation events that occurred until the first rule |
| + // fetch is complete or the control app not installed callback was received or |
| + // until |kDefaultMaxNavigationEventsBuffered| navigation events were |
| + // buffered. |
| + scoped_ptr<std::vector<DataUseUINavigationBuffer>> ui_navigation_buffer; |
|
tbansal1
2016/03/08 18:15:00
s/ui_navigation_buffer/data_use_ui_navigations_/?
tbansal1
2016/03/08 18:15:01
Also, why does this need to be a scoped_ptr, and n
tbansal1
2016/03/08 18:15:01
variable name should end with underscore.
tbansal1
2016/03/08 18:15:01
say more about this buffer: what is the order in w
|
| + |
| base::ThreadChecker thread_checker_; |
| base::WeakPtrFactory<DataUseTabModel> weak_factory_; |