| 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 #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 5 #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| 6 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 6 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/profiler/stack_sampling_profiler.h" |
| 11 #include "base/tracked_objects.h" | 12 #include "base/tracked_objects.h" |
| 12 #include "chrome/browser/chrome_browser_field_trials.h" | 13 #include "chrome/browser/chrome_browser_field_trials.h" |
| 13 #include "chrome/browser/chrome_process_singleton.h" | 14 #include "chrome/browser/chrome_process_singleton.h" |
| 14 #include "chrome/browser/first_run/first_run.h" | 15 #include "chrome/browser/first_run/first_run.h" |
| 15 #include "chrome/browser/process_singleton.h" | 16 #include "chrome/browser/process_singleton.h" |
| 16 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 17 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 17 #include "content/public/browser/browser_main_parts.h" | 18 #include "content/public/browser/browser_main_parts.h" |
| 18 #include "content/public/common/main_function_params.h" | 19 #include "content/public/common/main_function_params.h" |
| 19 | 20 |
| 20 class BrowserProcessImpl; | 21 class BrowserProcessImpl; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // switches. | 103 // switches. |
| 103 void SetupMetricsAndFieldTrials(); | 104 void SetupMetricsAndFieldTrials(); |
| 104 | 105 |
| 105 // Starts recording of metrics. This can only be called after we have a file | 106 // Starts recording of metrics. This can only be called after we have a file |
| 106 // thread. | 107 // thread. |
| 107 void StartMetricsRecording(); | 108 void StartMetricsRecording(); |
| 108 | 109 |
| 109 // Record time from process startup to present time in an UMA histogram. | 110 // Record time from process startup to present time in an UMA histogram. |
| 110 void RecordBrowserStartupTime(); | 111 void RecordBrowserStartupTime(); |
| 111 | 112 |
| 112 // Records a time value to an UMA histogram in the context of the | 113 // Create parameters for sampling stacks during startup. |
| 113 // PreReadExperiment field-trial. This also reports to the appropriate | 114 static base::StackSamplingProfiler::SamplingParams GetStartupSamplingParams(); |
| 114 // sub-histogram (_PreRead(Enabled|Disabled)). | |
| 115 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time); | |
| 116 | 115 |
| 117 // Methods for Main Message Loop ------------------------------------------- | 116 // Methods for Main Message Loop ------------------------------------------- |
| 118 | 117 |
| 119 int PreCreateThreadsImpl(); | 118 int PreCreateThreadsImpl(); |
| 120 int PreMainMessageLoopRunImpl(); | 119 int PreMainMessageLoopRunImpl(); |
| 121 | 120 |
| 122 // Members initialized on construction --------------------------------------- | 121 // Members initialized on construction --------------------------------------- |
| 123 | 122 |
| 124 const content::MainFunctionParams parameters_; | 123 const content::MainFunctionParams parameters_; |
| 125 const base::CommandLine& parsed_command_line_; | 124 const base::CommandLine& parsed_command_line_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 141 | 140 |
| 142 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 141 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 143 // A monitor for attributing power consumption to origins. | 142 // A monitor for attributing power consumption to origins. |
| 144 scoped_ptr<ProcessPowerCollector> process_power_collector_; | 143 scoped_ptr<ProcessPowerCollector> process_power_collector_; |
| 145 #endif | 144 #endif |
| 146 | 145 |
| 147 // Vector of additional ChromeBrowserMainExtraParts. | 146 // Vector of additional ChromeBrowserMainExtraParts. |
| 148 // Parts are deleted in the inverse order they are added. | 147 // Parts are deleted in the inverse order they are added. |
| 149 std::vector<ChromeBrowserMainExtraParts*> chrome_extra_parts_; | 148 std::vector<ChromeBrowserMainExtraParts*> chrome_extra_parts_; |
| 150 | 149 |
| 150 // A profiler that periodically samples stack traces. Used to sample startup |
| 151 // behavior. |
| 152 base::StackSamplingProfiler sampling_profiler_; |
| 153 |
| 151 // Members initialized after / released before main_message_loop_ ------------ | 154 // Members initialized after / released before main_message_loop_ ------------ |
| 152 | 155 |
| 153 scoped_ptr<BrowserProcessImpl> browser_process_; | 156 scoped_ptr<BrowserProcessImpl> browser_process_; |
| 154 scoped_refptr<metrics::TrackingSynchronizer> tracking_synchronizer_; | 157 scoped_refptr<metrics::TrackingSynchronizer> tracking_synchronizer_; |
| 155 #if !defined(OS_ANDROID) | 158 #if !defined(OS_ANDROID) |
| 156 // Browser creation happens on the Java side in Android. | 159 // Browser creation happens on the Java side in Android. |
| 157 scoped_ptr<StartupBrowserCreator> browser_creator_; | 160 scoped_ptr<StartupBrowserCreator> browser_creator_; |
| 158 | 161 |
| 159 // Android doesn't support multiple browser processes, so it doesn't implement | 162 // Android doesn't support multiple browser processes, so it doesn't implement |
| 160 // ProcessSingleton. | 163 // ProcessSingleton. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 176 PrefService* local_state_; | 179 PrefService* local_state_; |
| 177 base::FilePath user_data_dir_; | 180 base::FilePath user_data_dir_; |
| 178 | 181 |
| 179 // Members needed across shutdown methods. | 182 // Members needed across shutdown methods. |
| 180 bool restart_last_session_; | 183 bool restart_last_session_; |
| 181 | 184 |
| 182 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); | 185 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainParts); |
| 183 }; | 186 }; |
| 184 | 187 |
| 185 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ | 188 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ |
| OLD | NEW |