| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "chrome/browser/metrics/histogram_synchronizer.h" | 52 #include "chrome/browser/metrics/histogram_synchronizer.h" |
| 53 #include "chrome/browser/metrics/field_trial_synchronizer.h" | 53 #include "chrome/browser/metrics/field_trial_synchronizer.h" |
| 54 #include "chrome/browser/metrics/metrics_log.h" | 54 #include "chrome/browser/metrics/metrics_log.h" |
| 55 #include "chrome/browser/metrics/metrics_service.h" | 55 #include "chrome/browser/metrics/metrics_service.h" |
| 56 #include "chrome/browser/metrics/thread_watcher.h" | 56 #include "chrome/browser/metrics/thread_watcher.h" |
| 57 #include "chrome/browser/metrics/tracking_synchronizer.h" | 57 #include "chrome/browser/metrics/tracking_synchronizer.h" |
| 58 #include "chrome/browser/nacl_host/nacl_process_host.h" | 58 #include "chrome/browser/nacl_host/nacl_process_host.h" |
| 59 #include "chrome/browser/net/chrome_net_log.h" | 59 #include "chrome/browser/net/chrome_net_log.h" |
| 60 #include "chrome/browser/net/predictor.h" | 60 #include "chrome/browser/net/predictor.h" |
| 61 #include "chrome/browser/notifications/desktop_notification_service.h" | 61 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 62 #include "chrome/browser/page_cycler/page_cycler.h" |
| 62 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 63 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 63 #include "chrome/browser/plugin_prefs.h" | 64 #include "chrome/browser/plugin_prefs.h" |
| 64 #include "chrome/browser/prefs/pref_service.h" | 65 #include "chrome/browser/prefs/pref_service.h" |
| 65 #include "chrome/browser/prefs/pref_value_store.h" | 66 #include "chrome/browser/prefs/pref_value_store.h" |
| 66 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 67 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 67 #include "chrome/browser/prerender/prerender_field_trial.h" | 68 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 68 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 69 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 69 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 70 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 70 #include "chrome/browser/process_singleton.h" | 71 #include "chrome/browser/process_singleton.h" |
| 71 #include "chrome/browser/profiles/profile.h" | 72 #include "chrome/browser/profiles/profile.h" |
| (...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1445 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1445 chrome_extra_parts_[i]->PostProfileInit(); | 1446 chrome_extra_parts_[i]->PostProfileInit(); |
| 1446 } | 1447 } |
| 1447 | 1448 |
| 1448 void ChromeBrowserMainParts::PreBrowserStart() { | 1449 void ChromeBrowserMainParts::PreBrowserStart() { |
| 1449 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1450 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1450 chrome_extra_parts_[i]->PreBrowserStart(); | 1451 chrome_extra_parts_[i]->PreBrowserStart(); |
| 1451 } | 1452 } |
| 1452 | 1453 |
| 1453 void ChromeBrowserMainParts::PostBrowserStart() { | 1454 void ChromeBrowserMainParts::PostBrowserStart() { |
| 1455 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kVisitURLs)) |
| 1456 RunPageCycler(); |
| 1457 |
| 1454 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1458 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1455 chrome_extra_parts_[i]->PostBrowserStart(); | 1459 chrome_extra_parts_[i]->PostBrowserStart(); |
| 1456 // Allow ProcessSingleton to process messages. | 1460 // Allow ProcessSingleton to process messages. |
| 1457 process_singleton_->Unlock(); | 1461 process_singleton_->Unlock(); |
| 1458 } | 1462 } |
| 1459 | 1463 |
| 1464 void ChromeBrowserMainParts::RunPageCycler() { |
| 1465 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1466 Browser* browser = BrowserList::GetLastActive(); |
| 1467 DCHECK(browser); |
| 1468 PageCycler* page_cycler = NULL; |
| 1469 FilePath input_file = |
| 1470 command_line->GetSwitchValuePath(switches::kVisitURLs); |
| 1471 if (command_line->HasSwitch(switches::kRecordStats)) { |
| 1472 page_cycler = new PageCycler( |
| 1473 browser, |
| 1474 input_file, |
| 1475 input_file.AddExtension(FILE_PATH_LITERAL(".errors"))); |
| 1476 page_cycler->set_stats_file( |
| 1477 command_line->GetSwitchValuePath(switches::kRecordStats)); |
| 1478 } else { |
| 1479 page_cycler = new PageCycler( |
| 1480 browser, |
| 1481 input_file, |
| 1482 input_file.AddExtension(FILE_PATH_LITERAL(".errors"))); |
| 1483 } |
| 1484 int iterations = 1; |
| 1485 if (command_line->HasSwitch(switches::kVisitURLsCount)) { |
| 1486 CHECK(base::StringToInt( |
| 1487 command_line->GetSwitchValueNative(switches::kVisitURLsCount), |
| 1488 &iterations)); |
| 1489 } |
| 1490 page_cycler->Run(iterations); |
| 1491 } |
| 1492 |
| 1460 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { | 1493 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
| 1461 // Now that the file thread has been started, start recording. | 1494 // Now that the file thread has been started, start recording. |
| 1462 StartMetricsRecording(); | 1495 StartMetricsRecording(); |
| 1463 | 1496 |
| 1464 // Create watchdog thread after creating all other threads because it will | 1497 // Create watchdog thread after creating all other threads because it will |
| 1465 // watch the other threads and they must be running. | 1498 // watch the other threads and they must be running. |
| 1466 browser_process_->watchdog_thread(); | 1499 browser_process_->watchdog_thread(); |
| 1467 | 1500 |
| 1468 // Do any initializating in the browser process that requires all threads | 1501 // Do any initializating in the browser process that requires all threads |
| 1469 // running. | 1502 // running. |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2040 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 2008 uma_name += "_XP"; | 2041 uma_name += "_XP"; |
| 2009 | 2042 |
| 2010 uma_name += "_PreRead_"; | 2043 uma_name += "_PreRead_"; |
| 2011 uma_name += pre_read_percentage; | 2044 uma_name += pre_read_percentage; |
| 2012 AddPreReadHistogramTime(uma_name.c_str(), time); | 2045 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2013 } | 2046 } |
| 2014 #endif | 2047 #endif |
| 2015 #endif | 2048 #endif |
| 2016 } | 2049 } |
| OLD | NEW |