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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 if (parameters().ui_task) { | 1934 if (parameters().ui_task) { |
1935 parameters().ui_task->Run(); | 1935 parameters().ui_task->Run(); |
1936 delete parameters().ui_task; | 1936 delete parameters().ui_task; |
1937 run_message_loop_ = false; | 1937 run_message_loop_ = false; |
1938 } | 1938 } |
1939 | 1939 |
1940 return result_code_; | 1940 return result_code_; |
1941 } | 1941 } |
1942 | 1942 |
1943 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { | 1943 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 1944 #if defined(OS_ANDROID) |
| 1945 // Chrome on Android does not use default MessageLoop. It has its own |
| 1946 // Android specific MessageLoop |
| 1947 NOTREACHED(); |
| 1948 return true; |
| 1949 #else |
1944 // Set the result code set in PreMainMessageLoopRun or set above. | 1950 // Set the result code set in PreMainMessageLoopRun or set above. |
1945 *result_code = result_code_; | 1951 *result_code = result_code_; |
1946 if (!run_message_loop_) | 1952 if (!run_message_loop_) |
1947 return true; // Don't run the default message loop. | 1953 return true; // Don't run the default message loop. |
1948 | 1954 |
1949 // This should be invoked as close to the start of the browser's | 1955 // This should be invoked as close to the start of the browser's |
1950 // UI thread message loop as possible to get a stable measurement | 1956 // UI thread message loop as possible to get a stable measurement |
1951 // across versions. | 1957 // across versions. |
1952 RecordBrowserStartupTime(); | 1958 RecordBrowserStartupTime(); |
1953 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 1959 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
1954 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) | 1960 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) |
1955 views::AcceleratorHandler accelerator_handler; | 1961 views::AcceleratorHandler accelerator_handler; |
1956 base::RunLoop run_loop(&accelerator_handler); | 1962 base::RunLoop run_loop(&accelerator_handler); |
1957 #else | 1963 #else |
1958 base::RunLoop run_loop; | 1964 base::RunLoop run_loop; |
1959 #endif | 1965 #endif |
1960 run_loop.Run(); | 1966 run_loop.Run(); |
1961 | 1967 |
1962 return true; | 1968 return true; |
| 1969 #endif |
1963 } | 1970 } |
1964 | 1971 |
1965 void ChromeBrowserMainParts::PostMainMessageLoopRun() { | 1972 void ChromeBrowserMainParts::PostMainMessageLoopRun() { |
| 1973 #if defined(OS_ANDROID) |
| 1974 // Chrome on Android does not use default MessageLoop. It has its own |
| 1975 // Android specific MessageLoop |
| 1976 NOTREACHED(); |
| 1977 #else |
1966 // Start watching for jank during shutdown. It gets disarmed when | 1978 // Start watching for jank during shutdown. It gets disarmed when |
1967 // |shutdown_watcher_| object is destructed. | 1979 // |shutdown_watcher_| object is destructed. |
1968 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1980 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
1969 | 1981 |
1970 // Disarm the startup hang detector time bomb if it is still Arm'ed. | 1982 // Disarm the startup hang detector time bomb if it is still Arm'ed. |
1971 startup_watcher_->Disarm(); | 1983 startup_watcher_->Disarm(); |
1972 | 1984 |
1973 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1985 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
1974 chrome_extra_parts_[i]->PostMainMessageLoopRun(); | 1986 chrome_extra_parts_[i]->PostMainMessageLoopRun(); |
1975 | 1987 |
(...skipping 25 matching lines...) Expand all Loading... |
2001 if (notify_result_ == ProcessSingleton::PROCESS_NONE) | 2013 if (notify_result_ == ProcessSingleton::PROCESS_NONE) |
2002 process_singleton_->Cleanup(); | 2014 process_singleton_->Cleanup(); |
2003 | 2015 |
2004 // Stop all tasks that might run on WatchDogThread. | 2016 // Stop all tasks that might run on WatchDogThread. |
2005 ThreadWatcherList::StopWatchingAll(); | 2017 ThreadWatcherList::StopWatchingAll(); |
2006 | 2018 |
2007 browser_process_->metrics_service()->Stop(); | 2019 browser_process_->metrics_service()->Stop(); |
2008 | 2020 |
2009 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); | 2021 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); |
2010 browser_process_->StartTearDown(); | 2022 browser_process_->StartTearDown(); |
| 2023 #endif |
2011 } | 2024 } |
2012 | 2025 |
2013 void ChromeBrowserMainParts::PostDestroyThreads() { | 2026 void ChromeBrowserMainParts::PostDestroyThreads() { |
2014 browser_process_->PostDestroyThreads(); | 2027 browser_process_->PostDestroyThreads(); |
2015 // browser_shutdown takes care of deleting browser_process, so we need to | 2028 // browser_shutdown takes care of deleting browser_process, so we need to |
2016 // release it. | 2029 // release it. |
2017 ignore_result(browser_process_.release()); | 2030 ignore_result(browser_process_.release()); |
2018 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_); | 2031 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_); |
2019 master_prefs_.reset(); | 2032 master_prefs_.reset(); |
2020 process_singleton_.reset(); | 2033 process_singleton_.reset(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2086 if (base::win::GetVersion() <= base::win::VERSION_XP) |
2074 uma_name += "_XP"; | 2087 uma_name += "_XP"; |
2075 | 2088 |
2076 uma_name += "_PreRead_"; | 2089 uma_name += "_PreRead_"; |
2077 uma_name += pre_read_percentage; | 2090 uma_name += pre_read_percentage; |
2078 AddPreReadHistogramTime(uma_name.c_str(), time); | 2091 AddPreReadHistogramTime(uma_name.c_str(), time); |
2079 } | 2092 } |
2080 #endif | 2093 #endif |
2081 #endif | 2094 #endif |
2082 } | 2095 } |
OLD | NEW |