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 #if defined(OS_ANDROID) | 1401 #if defined(OS_ANDROID) |
1396 // Chrome on Android does not use default MessageLoop. It has its own | 1402 // Chrome on Android does not use default MessageLoop. It has its own |
1397 // Android specific MessageLoop | 1403 // Android specific MessageLoop |
1398 NOTREACHED(); | 1404 NOTREACHED(); |
1399 return true; | 1405 return true; |
1400 #else | 1406 #else |
1401 // Set the result code set in PreMainMessageLoopRun or set above. | 1407 // Set the result code set in PreMainMessageLoopRun or set above. |
1402 *result_code = result_code_; | 1408 *result_code = result_code_; |
1403 if (!run_message_loop_) | 1409 if (!run_message_loop_) |
1404 return true; // Don't run the default message loop. | 1410 return true; // Don't run the default message loop. |
1405 | 1411 |
1406 // This should be invoked as close to the start of the browser's | 1412 // These should be invoked as close to the start of the browser's |
1407 // UI thread message loop as possible to get a stable measurement | 1413 // UI thread message loop as possible to get a stable measurement |
1408 // across versions. | 1414 // across versions. |
1409 RecordBrowserStartupTime(); | 1415 RecordBrowserStartupTime(); |
| 1416 startup_timer_->SignalStartupComplete( |
| 1417 performance_monitor::StartupTimer::STARTUP_NORMAL); |
| 1418 |
1410 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 1419 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
1411 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) | 1420 #if !defined(USE_AURA) && defined(TOOLKIT_VIEWS) |
1412 views::AcceleratorHandler accelerator_handler; | 1421 views::AcceleratorHandler accelerator_handler; |
1413 base::RunLoop run_loop(&accelerator_handler); | 1422 base::RunLoop run_loop(&accelerator_handler); |
1414 #else | 1423 #else |
1415 base::RunLoop run_loop; | 1424 base::RunLoop run_loop; |
1416 #endif | 1425 #endif |
1417 run_loop.Run(); | 1426 run_loop.Run(); |
1418 | 1427 |
1419 return true; | 1428 return true; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1546 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1538 uma_name += "_XP"; | 1547 uma_name += "_XP"; |
1539 | 1548 |
1540 uma_name += "_PreRead_"; | 1549 uma_name += "_PreRead_"; |
1541 uma_name += pre_read_percentage; | 1550 uma_name += pre_read_percentage; |
1542 AddPreReadHistogramTime(uma_name.c_str(), time); | 1551 AddPreReadHistogramTime(uma_name.c_str(), time); |
1543 } | 1552 } |
1544 #endif | 1553 #endif |
1545 #endif | 1554 #endif |
1546 } | 1555 } |
OLD | NEW |