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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "chrome/browser/metrics/metrics_log.h" | 49 #include "chrome/browser/metrics/metrics_log.h" |
50 #include "chrome/browser/metrics/metrics_service.h" | 50 #include "chrome/browser/metrics/metrics_service.h" |
51 #include "chrome/browser/metrics/thread_watcher.h" | 51 #include "chrome/browser/metrics/thread_watcher.h" |
52 #include "chrome/browser/metrics/tracking_synchronizer.h" | 52 #include "chrome/browser/metrics/tracking_synchronizer.h" |
53 #include "chrome/browser/metrics/variations_service.h" | 53 #include "chrome/browser/metrics/variations_service.h" |
54 #include "chrome/browser/nacl_host/nacl_process_host.h" | 54 #include "chrome/browser/nacl_host/nacl_process_host.h" |
55 #include "chrome/browser/net/chrome_net_log.h" | 55 #include "chrome/browser/net/chrome_net_log.h" |
56 #include "chrome/browser/notifications/desktop_notification_service.h" | 56 #include "chrome/browser/notifications/desktop_notification_service.h" |
57 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 57 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
58 #include "chrome/browser/page_cycler/page_cycler.h" | 58 #include "chrome/browser/page_cycler/page_cycler.h" |
| 59 #include "chrome/browser/performance_monitor/startup_timer.h" |
59 #include "chrome/browser/plugin_prefs.h" | 60 #include "chrome/browser/plugin_prefs.h" |
60 #include "chrome/browser/prefs/pref_service.h" | 61 #include "chrome/browser/prefs/pref_service.h" |
61 #include "chrome/browser/prefs/pref_value_store.h" | 62 #include "chrome/browser/prefs/pref_value_store.h" |
62 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 63 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
63 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 64 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
64 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 65 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
65 #include "chrome/browser/process_singleton.h" | 66 #include "chrome/browser/process_singleton.h" |
66 #include "chrome/browser/profiles/profile.h" | 67 #include "chrome/browser/profiles/profile.h" |
67 #include "chrome/browser/profiles/profile_manager.h" | 68 #include "chrome/browser/profiles/profile_manager.h" |
68 #include "chrome/browser/search_engines/search_engine_type.h" | 69 #include "chrome/browser/search_engines/search_engine_type.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = | 492 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = |
492 false; | 493 false; |
493 | 494 |
494 ChromeBrowserMainParts::ChromeBrowserMainParts( | 495 ChromeBrowserMainParts::ChromeBrowserMainParts( |
495 const content::MainFunctionParams& parameters) | 496 const content::MainFunctionParams& parameters) |
496 : parameters_(parameters), | 497 : parameters_(parameters), |
497 parsed_command_line_(parameters.command_line), | 498 parsed_command_line_(parameters.command_line), |
498 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 499 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
499 startup_watcher_(new StartupTimeBomb()), | 500 startup_watcher_(new StartupTimeBomb()), |
500 shutdown_watcher_(new ShutdownWatcherHelper()), | 501 shutdown_watcher_(new ShutdownWatcherHelper()), |
| 502 startup_timer_(new performance_monitor::StartupTimer()), |
501 browser_field_trials_(parameters.command_line), | 503 browser_field_trials_(parameters.command_line), |
502 record_search_engine_(false), | 504 record_search_engine_(false), |
503 translate_manager_(NULL), | 505 translate_manager_(NULL), |
504 profile_(NULL), | 506 profile_(NULL), |
505 run_message_loop_(true), | 507 run_message_loop_(true), |
506 notify_result_(ProcessSingleton::PROCESS_NONE), | 508 notify_result_(ProcessSingleton::PROCESS_NONE), |
507 is_first_run_(false), | 509 is_first_run_(false), |
508 first_run_ui_bypass_(false), | 510 first_run_ui_bypass_(false), |
509 local_state_(NULL), | 511 local_state_(NULL), |
510 restart_last_session_(false) { | 512 restart_last_session_(false) { |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 | 1378 |
1377 run_message_loop_ = true; | 1379 run_message_loop_ = true; |
1378 } else { | 1380 } else { |
1379 run_message_loop_ = false; | 1381 run_message_loop_ = false; |
1380 } | 1382 } |
1381 browser_creator_.reset(); | 1383 browser_creator_.reset(); |
1382 | 1384 |
1383 PostBrowserStart(); | 1385 PostBrowserStart(); |
1384 | 1386 |
1385 if (parameters().ui_task) { | 1387 if (parameters().ui_task) { |
| 1388 // We end the startup timer here if we have parameters to run, because we |
| 1389 // never start to run the main loop (where we normally stop the timer). |
| 1390 startup_timer_->SignalStartupComplete( |
| 1391 performance_monitor::StartupTimer::STARTUP_TEST); |
1386 parameters().ui_task->Run(); | 1392 parameters().ui_task->Run(); |
1387 delete parameters().ui_task; | 1393 delete parameters().ui_task; |
1388 run_message_loop_ = false; | 1394 run_message_loop_ = false; |
1389 } | 1395 } |
1390 | 1396 |
1391 return result_code_; | 1397 return result_code_; |
1392 } | 1398 } |
1393 | 1399 |
1394 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { | 1400 bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { |
1395 // Set the result code set in PreMainMessageLoopRun or set above. | 1401 // Set the result code set in PreMainMessageLoopRun or set above. |
1396 *result_code = result_code_; | 1402 *result_code = result_code_; |
1397 if (!run_message_loop_) | 1403 if (!run_message_loop_) |
1398 return true; // Don't run the default message loop. | 1404 return true; // Don't run the default message loop. |
1399 | 1405 |
1400 // This should be invoked as close to the start of the browser's | 1406 // These should be invoked as close to the start of the browser's |
1401 // UI thread message loop as possible to get a stable measurement | 1407 // UI thread message loop as possible to get a stable measurement |
1402 // across versions. | 1408 // across versions. |
1403 RecordBrowserStartupTime(); | 1409 RecordBrowserStartupTime(); |
| 1410 startup_timer_->SignalStartupComplete( |
| 1411 performance_monitor::StartupTimer::STARTUP_NORMAL); |
| 1412 |
1404 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 1413 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
1405 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) | 1414 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) |
1406 views::AcceleratorHandler accelerator_handler; | 1415 views::AcceleratorHandler accelerator_handler; |
1407 base::RunLoop run_loop(&accelerator_handler); | 1416 base::RunLoop run_loop(&accelerator_handler); |
1408 #else | 1417 #else |
1409 base::RunLoop run_loop; | 1418 base::RunLoop run_loop; |
1410 #endif | 1419 #endif |
1411 run_loop.Run(); | 1420 run_loop.Run(); |
1412 | 1421 |
1413 return true; | 1422 return true; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1533 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1525 uma_name += "_XP"; | 1534 uma_name += "_XP"; |
1526 | 1535 |
1527 uma_name += "_PreRead_"; | 1536 uma_name += "_PreRead_"; |
1528 uma_name += pre_read_percentage; | 1537 uma_name += pre_read_percentage; |
1529 AddPreReadHistogramTime(uma_name.c_str(), time); | 1538 AddPreReadHistogramTime(uma_name.c_str(), time); |
1530 } | 1539 } |
1531 #endif | 1540 #endif |
1532 #endif | 1541 #endif |
1533 } | 1542 } |
OLD | NEW |