OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 class CommandLine; | 14 class CommandLine; |
15 class HighResolutionTimerManager; | 15 class HighResolutionTimerManager; |
16 class MessageLoop; | 16 class MessageLoop; |
17 | 17 |
18 struct MainFunctionParams; | |
19 | |
20 namespace base { | 18 namespace base { |
21 class SystemMonitor; | 19 class SystemMonitor; |
22 } | 20 } |
23 | 21 |
24 namespace net { | 22 namespace net { |
25 class NetworkChangeNotifier; | 23 class NetworkChangeNotifier; |
26 } | 24 } |
27 | 25 |
28 namespace content { | 26 namespace content { |
29 | 27 |
30 class BrowserMainParts; | 28 class BrowserMainParts; |
31 class BrowserThreadImpl; | 29 class BrowserThreadImpl; |
| 30 struct MainFunctionParams; |
32 | 31 |
33 // Implements the main browser loop stages called from |BrowserMain()|. | 32 // Implements the main browser loop stages called from |BrowserMain()|. |
34 // See comments in browser_main_parts.h for additional info. | 33 // See comments in browser_main_parts.h for additional info. |
35 class BrowserMainLoop { | 34 class BrowserMainLoop { |
36 public: | 35 public: |
37 explicit BrowserMainLoop(const MainFunctionParams& parameters); | 36 explicit BrowserMainLoop(const content::MainFunctionParams& parameters); |
38 virtual ~BrowserMainLoop(); | 37 virtual ~BrowserMainLoop(); |
39 | 38 |
40 void Init(); | 39 void Init(); |
41 | 40 |
42 void EarlyInitialization(); | 41 void EarlyInitialization(); |
43 void InitializeToolkit(); | 42 void InitializeToolkit(); |
44 void MainMessageLoopStart(); | 43 void MainMessageLoopStart(); |
45 void RunMainMessageLoopParts(bool* completed_main_message_loop); | 44 void RunMainMessageLoopParts(bool* completed_main_message_loop); |
46 void MainMessageLoopRun(); | 45 void MainMessageLoopRun(); |
47 | 46 |
48 int GetResultCode() const { return result_code_; } | 47 int GetResultCode() const { return result_code_; } |
49 | 48 |
50 private: | 49 private: |
51 void InitializeMainThread(); | 50 void InitializeMainThread(); |
52 | 51 |
53 // Members initialized on construction --------------------------------------- | 52 // Members initialized on construction --------------------------------------- |
54 const MainFunctionParams& parameters_; | 53 const content::MainFunctionParams& parameters_; |
55 const CommandLine& parsed_command_line_; | 54 const CommandLine& parsed_command_line_; |
56 int result_code_; | 55 int result_code_; |
57 | 56 |
58 // Vector of BrowserMainParts set by CreateBrowserMainParts ------------------ | 57 // Vector of BrowserMainParts set by CreateBrowserMainParts ------------------ |
59 // The BrowserParts fucntions for each part are called in the order added. | 58 // The BrowserParts fucntions for each part are called in the order added. |
60 // They are released (destroyed) in the reverse order. | 59 // They are released (destroyed) in the reverse order. |
61 std::vector<BrowserMainParts*> parts_list_; | 60 std::vector<BrowserMainParts*> parts_list_; |
62 | 61 |
63 // Members initialized in |MainMessageLoopStart()| --------------------------- | 62 // Members initialized in |MainMessageLoopStart()| --------------------------- |
64 scoped_ptr<MessageLoop> main_message_loop_; | 63 scoped_ptr<MessageLoop> main_message_loop_; |
65 scoped_ptr<base::SystemMonitor> system_monitor_; | 64 scoped_ptr<base::SystemMonitor> system_monitor_; |
66 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; | 65 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; |
67 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 66 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
68 scoped_ptr<BrowserThreadImpl> main_thread_; | 67 scoped_ptr<BrowserThreadImpl> main_thread_; |
69 | 68 |
70 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); | 69 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
71 }; | 70 }; |
72 | 71 |
73 } // namespace content | 72 } // namespace content |
74 | 73 |
75 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ | 74 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
OLD | NEW |