Commit c243c5e7 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Initialize WebStateListMetricsBrowser after SessionRestorationBrowser

WebStateListMetricsBrowser requires SessionRestorationBrowserAgent,
so it must be initialized earlier.

Also initialize WebStateListMetricsBrowser member variables that were
left uninitialized.

Bug: 1132784
Change-Id: I28b9d5afca58870a6273eb1c3b3418a45c9fcd69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435344
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Auto-Submit: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811236}
parent 5a9ab966
......@@ -42,6 +42,12 @@ void AttachBrowserAgents(Browser* browser) {
DeviceSharingBrowserAgent::CreateForBrowser(browser);
UrlLoadingNotifierBrowserAgent::CreateForBrowser(browser);
AppLauncherBrowserAgent::CreateForBrowser(browser);
// SessionRestorartionAgent requires WebUsageEnablerBrowserAgent.
SessionRestorationBrowserAgent::CreateForBrowser(
browser, [SessionServiceIOS sharedService]);
// WebStateListMetricsBrowserAgent requires SessionRestorationBrowserAgent.
WebStateListMetricsBrowserAgent::CreateForBrowser(browser);
ClosingWebStateObserverBrowserAgent::CreateForBrowser(browser);
SnapshotBrowserAgent::CreateForBrowser(browser);
......@@ -53,10 +59,6 @@ void AttachBrowserAgents(Browser* browser) {
// UrlLoadingBrowserAgent requires UrlLoadingNotifierBrowserAgent.
UrlLoadingBrowserAgent::CreateForBrowser(browser);
// SessionRestorartionAgent requires WebUsageEnablerBrowserAgent.
SessionRestorationBrowserAgent::CreateForBrowser(
browser, [SessionServiceIOS sharedService]);
// TabUsageRecorderBrowserAgent and WebStateListMetricsBrowserAgent observe
// the SessionRestorationBrowserAgent, so they should be created after the the
// SessionRestorationBrowserAgent is created.
......
......@@ -67,10 +67,10 @@ class WebStateListMetricsBrowserAgent
WebStateList* web_state_list_; // weak
// Counters for metrics.
int inserted_web_state_counter_;
int detached_web_state_counter_;
int activated_web_state_counter_;
bool metric_collection_paused_;
int inserted_web_state_counter_ = 0;
int detached_web_state_counter_ = 0;
int activated_web_state_counter_ = 0;
bool metric_collection_paused_ = false;
DISALLOW_COPY_AND_ASSIGN(WebStateListMetricsBrowserAgent);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment