New issue
Advanced search Search tips

Issue 800358 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug

Blocking:
issue 800357



Sign in to add a comment

Make feature trials available earlier

Project Member Reported by sky@chromium.org, Jan 9 2018

Issue description

Finch depends upon localstate, which is not available until BrowserMainLoop::PreCreateThreads. I have a feature I need to test for availability before this (specifically BrowserMainLoop::InitializeToolkit). This bug is to investigate if it's possible to move creation before BrowserMainLoop::InitializeToolkit.
 
This could be a potnential issue on Ash as well; ash::Shell asynchronously loads local_state_ via a mojo service.

(The delayed load of local_state_ in Ash has other issues as well, e.g.  issue 801394  which was due to a failed attempt to address  issue 678949 )

Comment 2 by sky@chromium.org, Jan 12 2018

If I'm able to get local_state loaded earlier, then in theory in Shell's constructor local_state would be loaded.
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/25ef6b6996540a43083adab93db3accfc50816bf

commit 25ef6b6996540a43083adab93db3accfc50816bf
Author: Scott Violet <sky@chromium.org>
Date: Wed Jan 17 05:37:22 2018

Wires up EarlyInitialization failing triggering exit

BUG= 800358 
TEST=none

Change-Id: I9d4cbc547acb491e77f31556eb22e12e44519651
Reviewed-on: https://chromium-review.googlesource.com/864840
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529631}
[modify] https://crrev.com/25ef6b6996540a43083adab93db3accfc50816bf/content/browser/browser_main_runner.cc

Project Member

Comment 4 by bugdroid1@chromium.org, Jan 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6145030d4b27ad7f5b4a8a7773be802e966e5f63

commit 6145030d4b27ad7f5b4a8a7773be802e966e5f63
Author: Scott Violet <sky@chromium.org>
Date: Thu Jan 18 18:33:28 2018

Make PolicyServiceImpl and BrowserPolicyConnectorBase have explicit setter

The AddPolicyProvider function has been removed in favor of a single setter.
This makes it clear when the PolicyServiceImpl is initialized.

BUG= 800358 
TEST=covered by tests

Change-Id: I616fbf3884a6d653d1b6734594c2e48d52a0b665
Reviewed-on: https://chromium-review.googlesource.com/865850
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530207}
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/android_webview/browser/aw_browser_policy_connector.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/policy/chrome_browser_policy_connector.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/policy/chrome_browser_policy_connector.h
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/policy/profile_policy_connector.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/policy/profile_policy_connector_factory.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/browser/prefs/proxy_policy_unittest.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/chrome/test/base/testing_profile.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/browser/browser_policy_connector.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/browser/browser_policy_connector_base.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/browser/browser_policy_connector_base.h
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/browser/configuration_policy_pref_store_test.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/browser/configuration_policy_pref_store_test.h
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/browser/proxy_policy_handler_unittest.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/common/policy_service_impl.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/common/policy_service_impl.h
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/components/policy/core/common/policy_service_impl_unittest.cc
[modify] https://crrev.com/6145030d4b27ad7f5b4a8a7773be802e966e5f63/remoting/host/policy_watcher.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Jan 18 2018

Project Member

Comment 6 by bugdroid1@chromium.org, Jan 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c6699a336684ed4106bfa9f2cfce8015881b1b0e

commit c6699a336684ed4106bfa9f2cfce8015881b1b0e
Author: Scott Violet <sky@chromium.org>
Date: Fri Jan 19 00:32:05 2018

Adds callback to BrowserPolicyConnectorBase when ResourceBundle loaded

This avoids a PostTask and is needed for moving loading of local
state earlier (when ResourceBundle won't be loaded).

BUG= 800358 
TEST=covered by tests

Change-Id: I7336dbec6474b0d29aa8596110f9c13ad5128148
Reviewed-on: https://chromium-review.googlesource.com/868735
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530363}
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/android_webview/browser/aw_browser_context.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/chrome/browser/download/download_dir_policy_handler_unittest.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/chrome/browser/policy/chrome_browser_policy_connector.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/chrome/browser/policy/chrome_browser_policy_connector.h
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/browser_policy_connector_base.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/browser_policy_connector_base.h
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/configuration_policy_pref_store.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/configuration_policy_pref_store.h
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/configuration_policy_pref_store_test.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/policy_error_map.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/policy_error_map.h
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/policy/core/browser/proxy_policy_handler_unittest.cc
[modify] https://crrev.com/c6699a336684ed4106bfa9f2cfce8015881b1b0e/components/sync_preferences/pref_service_syncable_factory.cc

Project Member

Comment 7 by bugdroid1@chromium.org, Jan 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6c4efb8dd66c61b5ee55453e021f43d58a4d3093

commit 6c4efb8dd66c61b5ee55453e021f43d58a4d3093
Author: Scott Violet <sky@chromium.org>
Date: Mon Jan 22 21:36:16 2018

Makes metrics_reporting_state not use g_browser_process

This is a precursor to loading local state, about flags and field
trials earlier, before BrowserProcess has been created.

BUG= 800358 
TEST=none

Change-Id: I22dc0f6422e53073c06e183f6dc396b49a524633
Reviewed-on: https://chromium-review.googlesource.com/865154
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531003}
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/android/metrics/uma_session_stats.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/chromeos/login/wizard_controller.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/chromeos/settings/device_settings_cache.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/chromeos/settings/device_settings_cache.h
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/domain_reliability/service_factory.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/extensions/api/metrics_private/chrome_metrics_private_delegate.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/first_run/first_run_internal_posix.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/lifetime/application_lifetime.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/chrome_metrics_service_accessor.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/chrome_metrics_service_accessor.h
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/chrome_metrics_service_client.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/chrome_metrics_services_manager_client.h
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/metrics_reporting_state.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/metrics_reporting_state.h
[add] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/password_manager/chrome_password_manager_client.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/profiling_host/background_profiling_triggers.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/renderer_host/chrome_render_message_filter.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/safe_browsing/ui_manager.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/ui/cocoa/first_run_dialog.mm
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/ui/views/first_run_dialog.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/ui/views/session_crashed_bubble_view.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/ui/webui/crashes_ui.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/ui/webui/flash_ui.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/chrome/test/BUILD.gn
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/components/metrics/metrics_service_accessor.cc
[modify] https://crrev.com/6c4efb8dd66c61b5ee55453e021f43d58a4d3093/components/metrics/metrics_service_accessor.h

Project Member

Comment 8 by bugdroid1@chromium.org, Jan 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6d47d4076e434c6b26e783563edd2ab48533e731

commit 6d47d4076e434c6b26e783563edd2ab48533e731
Author: Findit <findit-for-me@appspot.gserviceaccount.com>
Date: Mon Jan 22 22:23:54 2018

Revert "Makes metrics_reporting_state not use g_browser_process"

This reverts commit 6c4efb8dd66c61b5ee55453e021f43d58a4d3093.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 531003 as the
culprit for failures in the build cycles as shown on:
https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzZjNGVmYjhkZDY2YzYxYjVlZTU1NDUzZTAyMWY0M2Q1OGE0ZDMwOTMM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium.chrome/Google%20Chrome%20Win/26183

Original change's description:
> Makes metrics_reporting_state not use g_browser_process
> 
> This is a precursor to loading local state, about flags and field
> trials earlier, before BrowserProcess has been created.
> 
> BUG= 800358 
> TEST=none
> 
> Change-Id: I22dc0f6422e53073c06e183f6dc396b49a524633
> Reviewed-on: https://chromium-review.googlesource.com/865154
> Commit-Queue: Scott Violet <sky@chromium.org>
> Reviewed-by: Mark Pearson <mpearson@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#531003}

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
BUG= 800358 

Change-Id: I93683145391bc9d869a71e19e945f97033fbfc9c
Reviewed-on: https://chromium-review.googlesource.com/879531
Cr-Commit-Position: refs/heads/master@{#531014}
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/android/metrics/uma_session_stats.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/chromeos/login/wizard_controller.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/chromeos/settings/device_settings_cache.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/chromeos/settings/device_settings_cache.h
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/domain_reliability/service_factory.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/extensions/api/metrics_private/chrome_metrics_private_delegate.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/first_run/first_run_internal_posix.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/lifetime/application_lifetime.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/chrome_metrics_service_accessor.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/chrome_metrics_service_accessor.h
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/chrome_metrics_service_client.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/chrome_metrics_services_manager_client.h
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/metrics_reporting_state.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/metrics/metrics_reporting_state.h
[delete] https://crrev.com/2b2f89789e133c8904e505250e415699def7dea1/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/password_manager/chrome_password_manager_client.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/profiling_host/background_profiling_triggers.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/renderer_host/chrome_render_message_filter.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/safe_browsing/ui_manager.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/ui/cocoa/first_run_dialog.mm
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/ui/views/first_run_dialog.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/ui/views/session_crashed_bubble_view.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/ui/webui/crashes_ui.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/ui/webui/flash_ui.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/chrome/test/BUILD.gn
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/components/metrics/metrics_service_accessor.cc
[modify] https://crrev.com/6d47d4076e434c6b26e783563edd2ab48533e731/components/metrics/metrics_service_accessor.h

Project Member

Comment 9 by bugdroid1@chromium.org, Jan 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4607316b2f2aaaced9f4a8cbd9cc979cec21c044

commit 4607316b2f2aaaced9f4a8cbd9cc979cec21c044
Author: Scott Violet <sky@chromium.org>
Date: Tue Jan 23 21:40:34 2018

reland: Makes metrics_reporting_state not use g_browser_process

This is a precursor to loading local state, about flags and field
trials earlier, before BrowserProcess has been created.

BUG= 800358 
TEST=none

Change-Id: I647643d81702d6520401729916ed0a9f8311e5af
Reviewed-on: https://chromium-review.googlesource.com/879029
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531358}
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/android/metrics/uma_session_stats.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/chromeos/login/wizard_controller.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/chromeos/settings/device_settings_cache.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/chromeos/settings/device_settings_cache.h
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/domain_reliability/service_factory.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/extensions/api/metrics_private/chrome_metrics_private_delegate.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/first_run/first_run_internal_posix.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/lifetime/application_lifetime.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/chrome_metrics_service_accessor.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/chrome_metrics_service_accessor.h
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/chrome_metrics_service_client.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/chrome_metrics_services_manager_client.h
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/metrics_reporting_state.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/metrics_reporting_state.h
[add] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/password_manager/chrome_password_manager_client.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/profiling_host/background_profiling_triggers.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/renderer_host/chrome_render_message_filter.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/safe_browsing/ui_manager.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/ui/cocoa/first_run_dialog.mm
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/ui/views/first_run_dialog.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/ui/views/session_crashed_bubble_view.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/ui/webui/crashes_ui.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/ui/webui/flash_ui.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/chrome/test/BUILD.gn
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/components/metrics/metrics_service_accessor.cc
[modify] https://crrev.com/4607316b2f2aaaced9f4a8cbd9cc979cec21c044/components/metrics/metrics_service_accessor.h

Project Member

Comment 10 by bugdroid1@chromium.org, Jan 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a3aee722458ee66ade96e5dad31878e3570dea8f

commit a3aee722458ee66ade96e5dad31878e3570dea8f
Author: Scott Violet <sky@chromium.org>
Date: Wed Jan 31 18:29:21 2018

Moves loading of local_state and field trials to early initialization

There are two motivations for this change:
1. In order to run a field trial for state setup in creating toolkit.
2. To have local state ready at the time ash is created.

In order to have field trial ready I need to load local state and
everything it touches. This ended up including ResourceBundle (not
really the ResourceBundle, but the ResourceBundle code is used to
determine the locale, and the locale is needed by code related to
metrics, specifically ChromeMetricsServiceClient::GetApplicationLocale).

As much of this code was previously created at a time when task runners
were available I had to create a deferring task runner that queues up
tasks and then flushes them when the real task runner is available.

I've tried to only move what is necessary and leave as mush
initialization as possible in the place before this change.

You'll notice this creates g_browser_process early on. I explored not
doing this, but it turns out very painful as instead some code then
has to cache state that is later available in g_browser_process. The
camel that broke the straws back was the application locale. See
https://chromium-review.googlesource.com/c/chromium/src/+/853300 for
the early approach.

BUG= 800358 

Change-Id: Ib9aaddfbc04a0f3937bf268dd2af770b3f6746e0
Reviewed-on: https://chromium-review.googlesource.com/882558
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533338}
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/ash/shell/content/client/shell_browser_main_parts.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/ash/test/ash_test_helper.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/ash/window_manager_service.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/base/deferred_sequenced_task_runner.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/base/deferred_sequenced_task_runner.h
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/browser_process_impl.h
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/browser_process_impl_unittest.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/chrome_browser_main.h
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/chrome_browser_main_mac.mm
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/chromeos/chrome_browser_main_chromeos.h
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/extensions/api/image_writer_private/image_writer_private_apitest.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/metrics/chrome_metrics_services_manager_client.h
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chromeos/dbus/dbus_thread_manager.cc
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chromeos/dbus/dbus_thread_manager.h
[modify] https://crrev.com/a3aee722458ee66ade96e5dad31878e3570dea8f/chromeos/dbus/dbus_thread_manager_unittest.cc

Project Member

Comment 11 by bugdroid1@chromium.org, Jan 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c04da47de2642ee0d9161985e9a30a0b1c615790

commit c04da47de2642ee0d9161985e9a30a0b1c615790
Author: Xiyuan Xia <xiyuan@chromium.org>
Date: Wed Jan 31 23:41:31 2018

Revert "Moves loading of local_state and field trials to early initialization"

This reverts commit a3aee722458ee66ade96e5dad31878e3570dea8f.

Reason for revert:
amd64-generic-tot-chromium-pfq-informational is unhappy and chrome crashes on start up.

https://luci-milo.appspot.com/buildbot/chromiumos.chromium/amd64-generic-tot-chromium-pfq-informational/15124

Bug:  807775 

Original change's description:
> Moves loading of local_state and field trials to early initialization
> 
> There are two motivations for this change:
> 1. In order to run a field trial for state setup in creating toolkit.
> 2. To have local state ready at the time ash is created.
> 
> In order to have field trial ready I need to load local state and
> everything it touches. This ended up including ResourceBundle (not
> really the ResourceBundle, but the ResourceBundle code is used to
> determine the locale, and the locale is needed by code related to
> metrics, specifically ChromeMetricsServiceClient::GetApplicationLocale).
> 
> As much of this code was previously created at a time when task runners
> were available I had to create a deferring task runner that queues up
> tasks and then flushes them when the real task runner is available.
> 
> I've tried to only move what is necessary and leave as mush
> initialization as possible in the place before this change.
> 
> You'll notice this creates g_browser_process early on. I explored not
> doing this, but it turns out very painful as instead some code then
> has to cache state that is later available in g_browser_process. The
> camel that broke the straws back was the application locale. See
> https://chromium-review.googlesource.com/c/chromium/src/+/853300 for
> the early approach.
> 
> BUG= 800358 
> 
> Change-Id: Ib9aaddfbc04a0f3937bf268dd2af770b3f6746e0
> Reviewed-on: https://chromium-review.googlesource.com/882558
> Commit-Queue: Scott Violet <sky@chromium.org>
> Reviewed-by: James Cook <jamescook@chromium.org>
> Reviewed-by: Mark Pearson <mpearson@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#533338}

TBR=jamescook@chromium.org,sky@chromium.org,mpearson@chromium.org,thestig@chromium.org,emaxx@chromium.org,mark@chromium.org

Change-Id: I45ebd756896f13659e4d3dddf8e70faae9723f31
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  800358 
Reviewed-on: https://chromium-review.googlesource.com/896483
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533472}
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/ash/shell/content/client/shell_browser_main_parts.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/ash/test/ash_test_helper.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/ash/window_manager_service.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/base/deferred_sequenced_task_runner.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/base/deferred_sequenced_task_runner.h
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/browser_process_impl.h
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/browser_process_impl_unittest.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/chrome_browser_main.h
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/chrome_browser_main_mac.mm
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/chromeos/chrome_browser_main_chromeos.h
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/extensions/api/image_writer_private/image_writer_private_apitest.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/metrics/chrome_metrics_services_manager_client.h
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chromeos/dbus/dbus_thread_manager.cc
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chromeos/dbus/dbus_thread_manager.h
[modify] https://crrev.com/c04da47de2642ee0d9161985e9a30a0b1c615790/chromeos/dbus/dbus_thread_manager_unittest.cc

Project Member

Comment 12 by bugdroid1@chromium.org, Feb 1 2018

Labels: merge-merged-3336
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/16304565fa4d774f25d832a9148068a431e09950

commit 16304565fa4d774f25d832a9148068a431e09950
Author: Xiyuan Xia <xiyuan@chromium.org>
Date: Thu Feb 01 16:56:22 2018

Revert "Moves loading of local_state and field trials to early initialization"

This reverts commit a3aee722458ee66ade96e5dad31878e3570dea8f.

Reason for revert:
amd64-generic-tot-chromium-pfq-informational is unhappy and chrome crashes on start up.

https://luci-milo.appspot.com/buildbot/chromiumos.chromium/amd64-generic-tot-chromium-pfq-informational/15124

Bug:  807775 

Original change's description:
> Moves loading of local_state and field trials to early initialization
> 
> There are two motivations for this change:
> 1. In order to run a field trial for state setup in creating toolkit.
> 2. To have local state ready at the time ash is created.
> 
> In order to have field trial ready I need to load local state and
> everything it touches. This ended up including ResourceBundle (not
> really the ResourceBundle, but the ResourceBundle code is used to
> determine the locale, and the locale is needed by code related to
> metrics, specifically ChromeMetricsServiceClient::GetApplicationLocale).
> 
> As much of this code was previously created at a time when task runners
> were available I had to create a deferring task runner that queues up
> tasks and then flushes them when the real task runner is available.
> 
> I've tried to only move what is necessary and leave as mush
> initialization as possible in the place before this change.
> 
> You'll notice this creates g_browser_process early on. I explored not
> doing this, but it turns out very painful as instead some code then
> has to cache state that is later available in g_browser_process. The
> camel that broke the straws back was the application locale. See
> https://chromium-review.googlesource.com/c/chromium/src/+/853300 for
> the early approach.
> 
> BUG= 800358 
> 
> Change-Id: Ib9aaddfbc04a0f3937bf268dd2af770b3f6746e0
> Reviewed-on: https://chromium-review.googlesource.com/882558
> Commit-Queue: Scott Violet <sky@chromium.org>
> Reviewed-by: James Cook <jamescook@chromium.org>
> Reviewed-by: Mark Pearson <mpearson@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#533338}

TBR=jamescook@chromium.org,sky@chromium.org,mpearson@chromium.org,thestig@chromium.org,emaxx@chromium.org,mark@chromium.org

Change-Id: I45ebd756896f13659e4d3dddf8e70faae9723f31
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  800358 
Reviewed-on: https://chromium-review.googlesource.com/896483
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#533472}(cherry picked from commit c04da47de2642ee0d9161985e9a30a0b1c615790)
Reviewed-on: https://chromium-review.googlesource.com/897465
Cr-Commit-Position: refs/branch-heads/3336@{#3}
Cr-Branched-From: f9c9c93a13722b535707412b677f2cfb187fd17c-refs/heads/master@{#533409}
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/ash/shell/content/client/shell_browser_main_parts.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/ash/test/ash_test_helper.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/ash/window_manager_service.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/base/deferred_sequenced_task_runner.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/base/deferred_sequenced_task_runner.h
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/browser_process_impl.h
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/browser_process_impl_unittest.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/chrome_browser_main.h
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/chrome_browser_main_mac.mm
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/chromeos/chrome_browser_main_chromeos.h
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/extensions/api/image_writer_private/image_writer_private_apitest.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/metrics/chrome_metrics_services_manager_client.h
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chromeos/dbus/dbus_thread_manager.cc
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chromeos/dbus/dbus_thread_manager.h
[modify] https://crrev.com/16304565fa4d774f25d832a9148068a431e09950/chromeos/dbus/dbus_thread_manager_unittest.cc

Project Member

Comment 13 by bugdroid1@chromium.org, Feb 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/875789eaa469e365ac6fb7ac069f4ca6c0676cee

commit 875789eaa469e365ac6fb7ac069f4ca6c0676cee
Author: Scott Violet <sky@chromium.org>
Date: Fri Feb 02 07:46:48 2018

reland: Moves loading of local_state and field trials to early initialization

Original is here: https://chromium-review.googlesource.com/c/chromium/src/+/882558

This differs from the patch that landed in two ways:
1. I completely misunderstood RunsTasksInCurrentSequence(). It may be
   called on any thread and basically comes down to checking if the
   current thread matches the thread the TaskRunner runs on. Changed
   implementation of DeferredSequencedTaskRunner and
   DeferringTaskRunner appropriately (added test for this).
2. Master prefs need ResourceBundle loaded with the data pack, so,
   shuffled around loading of that. This is covered by browser_tests
   that sadly only run on official builder.

There are two motivations for this change:
1. In order to run a field trial for state setup in creating toolkit.
2. To have local state ready at the time ash is created.

In order to have field trial ready I need to load local state and
everything it touches. This ended up including ResourceBundle (not
really the ResourceBundle, but the ResourceBundle code is used to
determine the locale, and the locale is needed by code related to
metrics, specifically ChromeMetricsServiceClient::GetApplicationLocale).

As much of this code was previously created at a time when task runners
were available I had to create a deferring task runner that queues up
tasks and then flushes them when the real task runner is available.

I've tried to only move what is necessary and leave as mush
initialization as possible in the place before this change.

You'll notice this creates g_browser_process early on. I explored not
doing this, but it turns out very painful as instead some code then
has to cache state that is later available in g_browser_process. The
camel that broke the straws back was the application locale. See
https://chromium-review.googlesource.com/c/chromium/src/+/853300 for
the early approach.

BUG= 800358 
TBR=mark@chromium.org,jamescook@chromium.org,mpearson@chromium.org

Change-Id: I3343e8959321900daec0de16f6a86715d3760f29
Reviewed-on: https://chromium-review.googlesource.com/898070
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533989}
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/ash/shell/content/client/shell_browser_main_parts.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/ash/test/ash_test_helper.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/ash/window_manager_service.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/base/deferred_sequenced_task_runner.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/base/deferred_sequenced_task_runner.h
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/base/deferred_sequenced_task_runner_unittest.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/browser_process_impl.h
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/browser_process_impl_unittest.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/chrome_browser_main.h
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/chrome_browser_main_mac.mm
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/chromeos/chrome_browser_main_chromeos.h
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/extensions/api/image_writer_private/image_writer_private_apitest.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/metrics/chrome_metrics_services_manager_client.h
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chromeos/dbus/dbus_thread_manager.cc
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chromeos/dbus/dbus_thread_manager.h
[modify] https://crrev.com/875789eaa469e365ac6fb7ac069f4ca6c0676cee/chromeos/dbus/dbus_thread_manager_unittest.cc

Project Member

Comment 14 by bugdroid1@chromium.org, Feb 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a

commit 1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a
Author: Scott Violet <sky@chromium.org>
Date: Tue Feb 06 19:09:12 2018

Removes unnecessary parameters

This is a revert of most of
https://chromium-review.googlesource.com/c/chromium/src/+/879029
(the test stays). I did that patch at a time when I thought I
wouldn't create g_browser_process. I ended up creating
g_browser_process though, which means these changes were unnecessary.

BUG= 800358 
TEST=none

Change-Id: I49eedf78abc7d6a19c49effb0c35450958dc558b
Reviewed-on: https://chromium-review.googlesource.com/902683
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534742}
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/android/metrics/uma_session_stats.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/browser_process_impl.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/chromeos/login/wizard_controller.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/domain_reliability/service_factory.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/extensions/api/metrics_private/chrome_metrics_private_delegate.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/first_run/first_run_internal_posix.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/lifetime/application_lifetime.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/chrome_metrics_service_accessor.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/chrome_metrics_service_accessor.h
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/chrome_metrics_service_client.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/metrics_reporting_state.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/metrics_reporting_state.h
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/metrics/metrics_reporting_state_browsertest.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/password_manager/chrome_password_manager_client.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/profiling_host/background_profiling_triggers.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/renderer_host/chrome_render_message_filter.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/safe_browsing/download_protection/download_url_sb_client.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/safe_browsing/ui_manager.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/ui/cocoa/first_run_dialog.mm
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/ui/views/first_run_dialog.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/ui/views/session_crashed_bubble_view.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/ui/webui/crashes_ui.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/ui/webui/flash_ui.cc
[modify] https://crrev.com/1bec30b3a7deddb7dbe59f7aa6a762df2c55f68a/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc

Comment 15 by sky@chromium.org, Feb 6 2018

Status: Fixed (was: Started)

Sign in to add a comment