| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/atomic_ref_count.h" | 14 #include "base/atomic_ref_count.h" |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/debug/alias.h" | 18 #include "base/debug/alias.h" |
| 19 #include "base/debug/leak_annotations.h" | 19 #include "base/debug/leak_annotations.h" |
| 20 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
| 21 #include "base/location.h" |
| 21 #include "base/macros.h" | 22 #include "base/macros.h" |
| 22 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
| 23 #include "base/metrics/field_trial.h" | 24 #include "base/metrics/field_trial.h" |
| 24 #include "base/metrics/histogram_macros.h" | 25 #include "base/metrics/histogram_macros.h" |
| 25 #include "base/path_service.h" | 26 #include "base/path_service.h" |
| 27 #include "base/single_thread_task_runner.h" |
| 26 #include "base/synchronization/waitable_event.h" | 28 #include "base/synchronization/waitable_event.h" |
| 27 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
| 28 #include "base/threading/thread_restrictions.h" | 30 #include "base/threading/thread_restrictions.h" |
| 31 #include "base/threading/thread_task_runner_handle.h" |
| 29 #include "base/time/default_clock.h" | 32 #include "base/time/default_clock.h" |
| 30 #include "base/time/default_tick_clock.h" | 33 #include "base/time/default_tick_clock.h" |
| 31 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
| 32 #include "build/build_config.h" | 35 #include "build/build_config.h" |
| 33 #include "chrome/browser/chrome_browser_main.h" | 36 #include "chrome/browser/chrome_browser_main.h" |
| 34 #include "chrome/browser/chrome_child_process_watcher.h" | 37 #include "chrome/browser/chrome_child_process_watcher.h" |
| 35 #include "chrome/browser/chrome_content_browser_client.h" | 38 #include "chrome/browser/chrome_content_browser_client.h" |
| 36 #include "chrome/browser/chrome_device_client.h" | 39 #include "chrome/browser/chrome_device_client.h" |
| 37 #include "chrome/browser/chrome_notification_types.h" | 40 #include "chrome/browser/chrome_notification_types.h" |
| 38 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" | 41 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 // Check for memory leaks now, before we start shutting down threads. Doing | 1224 // Check for memory leaks now, before we start shutting down threads. Doing |
| 1222 // this early means we won't report any shutdown-only leaks (as they have | 1225 // this early means we won't report any shutdown-only leaks (as they have |
| 1223 // not yet happened at this point). | 1226 // not yet happened at this point). |
| 1224 // If leaks are found, this will make the process exit immediately. | 1227 // If leaks are found, this will make the process exit immediately. |
| 1225 __lsan_do_leak_check(); | 1228 __lsan_do_leak_check(); |
| 1226 #endif | 1229 #endif |
| 1227 | 1230 |
| 1228 CHECK(base::MessageLoop::current()->is_running()); | 1231 CHECK(base::MessageLoop::current()->is_running()); |
| 1229 | 1232 |
| 1230 #if defined(OS_MACOSX) | 1233 #if defined(OS_MACOSX) |
| 1231 base::MessageLoop::current()->PostTask( | 1234 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1232 FROM_HERE, base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); | 1235 FROM_HERE, base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); |
| 1233 #endif | 1236 #endif |
| 1234 base::MessageLoop::current()->QuitWhenIdle(); | 1237 base::MessageLoop::current()->QuitWhenIdle(); |
| 1235 | 1238 |
| 1236 #if !defined(OS_ANDROID) | 1239 #if !defined(OS_ANDROID) |
| 1237 chrome::ShutdownIfNeeded(); | 1240 chrome::ShutdownIfNeeded(); |
| 1238 #endif // !defined(OS_ANDROID) | 1241 #endif // !defined(OS_ANDROID) |
| 1239 } | 1242 } |
| 1240 | 1243 |
| 1241 // Mac is currently not supported. | 1244 // Mac is currently not supported. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 } | 1299 } |
| 1297 | 1300 |
| 1298 void BrowserProcessImpl::OnAutoupdateTimer() { | 1301 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1299 if (CanAutorestartForUpdate()) { | 1302 if (CanAutorestartForUpdate()) { |
| 1300 DLOG(WARNING) << "Detected update. Restarting browser."; | 1303 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1301 RestartBackgroundInstance(); | 1304 RestartBackgroundInstance(); |
| 1302 } | 1305 } |
| 1303 } | 1306 } |
| 1304 | 1307 |
| 1305 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1308 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |