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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 #include "chrome/browser/metrics/metrics_service.h" | 56 #include "chrome/browser/metrics/metrics_service.h" |
57 #include "chrome/browser/metrics/thread_watcher.h" | 57 #include "chrome/browser/metrics/thread_watcher.h" |
58 #include "chrome/browser/metrics/tracking_synchronizer.h" | 58 #include "chrome/browser/metrics/tracking_synchronizer.h" |
59 #include "chrome/browser/metrics/variations_service.h" | 59 #include "chrome/browser/metrics/variations_service.h" |
60 #include "chrome/browser/nacl_host/nacl_process_host.h" | 60 #include "chrome/browser/nacl_host/nacl_process_host.h" |
61 #include "chrome/browser/net/chrome_net_log.h" | 61 #include "chrome/browser/net/chrome_net_log.h" |
62 #include "chrome/browser/net/predictor.h" | 62 #include "chrome/browser/net/predictor.h" |
63 #include "chrome/browser/notifications/desktop_notification_service.h" | 63 #include "chrome/browser/notifications/desktop_notification_service.h" |
64 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 64 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
65 #include "chrome/browser/page_cycler/page_cycler.h" | 65 #include "chrome/browser/page_cycler/page_cycler.h" |
66 #include "chrome/browser/performance_monitor/startup_timer.h" | |
66 #include "chrome/browser/plugin_prefs.h" | 67 #include "chrome/browser/plugin_prefs.h" |
67 #include "chrome/browser/prefs/pref_service.h" | 68 #include "chrome/browser/prefs/pref_service.h" |
68 #include "chrome/browser/prefs/pref_value_store.h" | 69 #include "chrome/browser/prefs/pref_value_store.h" |
69 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 70 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
70 #include "chrome/browser/prerender/prerender_field_trial.h" | 71 #include "chrome/browser/prerender/prerender_field_trial.h" |
71 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 72 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
72 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" | 73 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" |
73 #include "chrome/browser/process_singleton.h" | 74 #include "chrome/browser/process_singleton.h" |
74 #include "chrome/browser/profiles/profile.h" | 75 #include "chrome/browser/profiles/profile.h" |
75 #include "chrome/browser/profiles/profile_manager.h" | 76 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = | 562 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = |
562 false; | 563 false; |
563 | 564 |
564 ChromeBrowserMainParts::ChromeBrowserMainParts( | 565 ChromeBrowserMainParts::ChromeBrowserMainParts( |
565 const content::MainFunctionParams& parameters) | 566 const content::MainFunctionParams& parameters) |
566 : parameters_(parameters), | 567 : parameters_(parameters), |
567 parsed_command_line_(parameters.command_line), | 568 parsed_command_line_(parameters.command_line), |
568 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 569 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
569 startup_watcher_(new StartupTimeBomb()), | 570 startup_watcher_(new StartupTimeBomb()), |
570 shutdown_watcher_(new ShutdownWatcherHelper()), | 571 shutdown_watcher_(new ShutdownWatcherHelper()), |
572 startup_timer_(new performance_monitor::StartupTimer()), | |
571 record_search_engine_(false), | 573 record_search_engine_(false), |
572 translate_manager_(NULL), | 574 translate_manager_(NULL), |
573 profile_(NULL), | 575 profile_(NULL), |
574 run_message_loop_(true), | 576 run_message_loop_(true), |
575 notify_result_(ProcessSingleton::PROCESS_NONE), | 577 notify_result_(ProcessSingleton::PROCESS_NONE), |
576 is_first_run_(false), | 578 is_first_run_(false), |
577 first_run_ui_bypass_(false), | 579 first_run_ui_bypass_(false), |
578 local_state_(NULL), | 580 local_state_(NULL), |
579 restart_last_session_(false) { | 581 restart_last_session_(false) { |
580 // If we're running tests (ui_task is non-null). | 582 // If we're running tests (ui_task is non-null). |
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1932 | 1934 |
1933 run_message_loop_ = true; | 1935 run_message_loop_ = true; |
1934 } else { | 1936 } else { |
1935 run_message_loop_ = false; | 1937 run_message_loop_ = false; |
1936 } | 1938 } |
1937 browser_creator_.reset(); | 1939 browser_creator_.reset(); |
1938 | 1940 |
1939 PostBrowserStart(); | 1941 PostBrowserStart(); |
1940 | 1942 |
1941 if (parameters().ui_task) { | 1943 if (parameters().ui_task) { |
1944 // We end the startup timer here if we have parameters to run, because we | |
1945 // never start to run the main loop (where we normally stop the timer). | |
1946 startup_timer_->SignalStartupComplete(false); // not normal startup. | |
Yoyo Zhou
2012/07/31 09:57:32
Looks like this could go in the if (!run_message_l
Devlin
2012/07/31 16:43:40
I thought the same thing, but the problem is that
| |
1942 parameters().ui_task->Run(); | 1947 parameters().ui_task->Run(); |
1943 delete parameters().ui_task; | 1948 delete parameters().ui_task; |
1944 run_message_loop_ = false; | 1949 run_message_loop_ = false; |
1945 } | 1950 } |
1946 | 1951 |
1947 return result_code_; | 1952 return result_code_; |
1948 } | 1953 } |
1949 | 1954 |
1950 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { | 1955 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { |
1951 // Set the result code set in PreMainMessageLoopRun or set above. | 1956 // Set the result code set in PreMainMessageLoopRun or set above. |
1952 *result_code = result_code_; | 1957 *result_code = result_code_; |
1953 if (!run_message_loop_) | 1958 if (!run_message_loop_) |
1954 return true; // Don't run the default message loop. | 1959 return true; // Don't run the default message loop. |
1955 | 1960 |
1956 // This should be invoked as close to the start of the browser's | 1961 // These should be invoked as close to the start of the browser's |
1957 // UI thread message loop as possible to get a stable measurement | 1962 // UI thread message loop as possible to get a stable measurement |
1958 // across versions. | 1963 // across versions. |
1959 RecordBrowserStartupTime(); | 1964 RecordBrowserStartupTime(); |
1965 startup_timer_->SignalStartupComplete(true); // normal startup. | |
1966 | |
1960 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 1967 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
1961 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) | 1968 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) |
1962 views::AcceleratorHandler accelerator_handler; | 1969 views::AcceleratorHandler accelerator_handler; |
1963 base::RunLoop run_loop(&accelerator_handler); | 1970 base::RunLoop run_loop(&accelerator_handler); |
1964 #else | 1971 #else |
1965 base::RunLoop run_loop; | 1972 base::RunLoop run_loop; |
1966 #endif | 1973 #endif |
1967 run_loop.Run(); | 1974 run_loop.Run(); |
1968 | 1975 |
1969 return true; | 1976 return true; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2080 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2087 if (base::win::GetVersion() <= base::win::VERSION_XP) |
2081 uma_name += "_XP"; | 2088 uma_name += "_XP"; |
2082 | 2089 |
2083 uma_name += "_PreRead_"; | 2090 uma_name += "_PreRead_"; |
2084 uma_name += pre_read_percentage; | 2091 uma_name += pre_read_percentage; |
2085 AddPreReadHistogramTime(uma_name.c_str(), time); | 2092 AddPreReadHistogramTime(uma_name.c_str(), time); |
2086 } | 2093 } |
2087 #endif | 2094 #endif |
2088 #endif | 2095 #endif |
2089 } | 2096 } |
OLD | NEW |