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 CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/timer/timer.h" |
11 #include "content/browser/browser_process_sub_thread.h" | 13 #include "content/browser/browser_process_sub_thread.h" |
12 #include "content/public/browser/browser_main_runner.h" | 14 #include "content/public/browser/browser_main_runner.h" |
13 | 15 |
14 namespace base { | 16 namespace base { |
15 class CommandLine; | 17 class CommandLine; |
16 class FilePath; | 18 class FilePath; |
17 class HighResolutionTimerManager; | 19 class HighResolutionTimerManager; |
18 class MessageLoop; | 20 class MessageLoop; |
19 class PowerMonitor; | 21 class PowerMonitor; |
20 class SystemMonitor; | 22 class SystemMonitor; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return media_stream_manager_.get(); | 99 return media_stream_manager_.get(); |
98 } | 100 } |
99 media::UserInputMonitor* user_input_monitor() const { | 101 media::UserInputMonitor* user_input_monitor() const { |
100 return user_input_monitor_.get(); | 102 return user_input_monitor_.get(); |
101 } | 103 } |
102 media::MidiManager* midi_manager() const { return midi_manager_.get(); } | 104 media::MidiManager* midi_manager() const { return midi_manager_.get(); } |
103 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } | 105 base::Thread* indexed_db_thread() const { return indexed_db_thread_.get(); } |
104 | 106 |
105 bool is_tracing_startup() const { return is_tracing_startup_; } | 107 bool is_tracing_startup() const { return is_tracing_startup_; } |
106 | 108 |
| 109 const base::FilePath& startup_trace_file() const { |
| 110 return startup_trace_file_; |
| 111 } |
| 112 |
| 113 void StopStartupTracingTimer(); |
| 114 |
107 #if defined(OS_MACOSX) && !defined(OS_IOS) | 115 #if defined(OS_MACOSX) && !defined(OS_IOS) |
108 DeviceMonitorMac* device_monitor_mac() const { | 116 DeviceMonitorMac* device_monitor_mac() const { |
109 return device_monitor_mac_.get(); | 117 return device_monitor_mac_.get(); |
110 } | 118 } |
111 #endif | 119 #endif |
112 | 120 |
113 private: | 121 private: |
114 class MemoryObserver; | 122 class MemoryObserver; |
115 // For ShutdownThreadsAndCleanUp. | 123 // For ShutdownThreadsAndCleanUp. |
116 friend class BrowserShutdownImpl; | 124 friend class BrowserShutdownImpl; |
117 | 125 |
118 void InitializeMainThread(); | 126 void InitializeMainThread(); |
119 | 127 |
120 // Called just before creating the threads | 128 // Called just before creating the threads |
121 int PreCreateThreads(); | 129 int PreCreateThreads(); |
122 | 130 |
123 // Create all secondary threads. | 131 // Create all secondary threads. |
124 int CreateThreads(); | 132 int CreateThreads(); |
125 | 133 |
126 // Called right after the browser threads have been started. | 134 // Called right after the browser threads have been started. |
127 int BrowserThreadsStarted(); | 135 int BrowserThreadsStarted(); |
128 | 136 |
129 int PreMainMessageLoopRun(); | 137 int PreMainMessageLoopRun(); |
130 | 138 |
131 void MainMessageLoopRun(); | 139 void MainMessageLoopRun(); |
132 | 140 |
| 141 base::FilePath GetStartupTraceFileName( |
| 142 const base::CommandLine& command_line) const; |
133 void InitStartupTracing(const base::CommandLine& command_line); | 143 void InitStartupTracing(const base::CommandLine& command_line); |
134 void EndStartupTracing(const base::FilePath& trace_file); | 144 void EndStartupTracing(); |
135 | 145 |
136 // Members initialized on construction --------------------------------------- | 146 // Members initialized on construction --------------------------------------- |
137 const MainFunctionParams& parameters_; | 147 const MainFunctionParams& parameters_; |
138 const base::CommandLine& parsed_command_line_; | 148 const base::CommandLine& parsed_command_line_; |
139 int result_code_; | 149 int result_code_; |
140 // True if the non-UI threads were created. | 150 // True if the non-UI threads were created. |
141 bool created_threads_; | 151 bool created_threads_; |
142 | 152 |
143 // Members initialized in |MainMessageLoopStart()| --------------------------- | 153 // Members initialized in |MainMessageLoopStart()| --------------------------- |
144 scoped_ptr<base::MessageLoop> main_message_loop_; | 154 scoped_ptr<base::MessageLoop> main_message_loop_; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 scoped_ptr<BrowserProcessSubThread> file_thread_; | 193 scoped_ptr<BrowserProcessSubThread> file_thread_; |
184 scoped_ptr<BrowserProcessSubThread> process_launcher_thread_; | 194 scoped_ptr<BrowserProcessSubThread> process_launcher_thread_; |
185 scoped_ptr<BrowserProcessSubThread> cache_thread_; | 195 scoped_ptr<BrowserProcessSubThread> cache_thread_; |
186 scoped_ptr<BrowserProcessSubThread> io_thread_; | 196 scoped_ptr<BrowserProcessSubThread> io_thread_; |
187 scoped_ptr<base::Thread> indexed_db_thread_; | 197 scoped_ptr<base::Thread> indexed_db_thread_; |
188 scoped_ptr<MemoryObserver> memory_observer_; | 198 scoped_ptr<MemoryObserver> memory_observer_; |
189 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; | 199 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; |
190 scoped_ptr<base::debug::TraceEventSystemStatsMonitor> system_stats_monitor_; | 200 scoped_ptr<base::debug::TraceEventSystemStatsMonitor> system_stats_monitor_; |
191 | 201 |
192 bool is_tracing_startup_; | 202 bool is_tracing_startup_; |
| 203 base::FilePath startup_trace_file_; |
| 204 |
| 205 // This timer initiates trace file saving. |
| 206 base::OneShotTimer<BrowserMainLoop> startup_trace_timer_; |
193 | 207 |
194 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 208 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
195 }; | 209 }; |
196 | 210 |
197 } // namespace content | 211 } // namespace content |
198 | 212 |
199 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 213 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
OLD | NEW |