OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Declaration of ATL module object for EXE module. | 5 // Declaration of ATL module object for EXE module. |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlhost.h> | 8 #include <atlhost.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/logging_win.h" | 14 #include "base/logging_win.h" |
15 #include "ceee/ie/broker/broker.h" | 15 #include "ceee/ie/broker/broker.h" |
16 #include "ceee/ie/broker/broker_rpc_server.h" | |
16 #include "ceee/ie/broker/chrome_postman.h" | 17 #include "ceee/ie/broker/chrome_postman.h" |
17 #include "ceee/ie/broker/executors_manager.h" | 18 #include "ceee/ie/broker/executors_manager.h" |
18 #include "ceee/ie/broker/resource.h" | 19 #include "ceee/ie/broker/resource.h" |
19 #include "ceee/ie/broker/window_events_funnel.h" | 20 #include "ceee/ie/broker/window_events_funnel.h" |
20 #include "ceee/ie/common/crash_reporter.h" | 21 #include "ceee/ie/common/crash_reporter.h" |
21 #include "ceee/common/com_utils.h" | 22 #include "ceee/common/com_utils.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 } | 73 } |
73 | 74 |
74 HRESULT PostMessageLoop(); | 75 HRESULT PostMessageLoop(); |
75 HRESULT PreMessageLoop(int show); | 76 HRESULT PreMessageLoop(int show); |
76 private: | 77 private: |
77 // We maintain a postman COM object on the stack so that we can | 78 // We maintain a postman COM object on the stack so that we can |
78 // properly initialize and terminate it at the right time. | 79 // properly initialize and terminate it at the right time. |
79 CComObjectStackEx<ChromePostman> chrome_postman_; | 80 CComObjectStackEx<ChromePostman> chrome_postman_; |
80 CrashReporter crash_reporter_; | 81 CrashReporter crash_reporter_; |
81 base::AtExitManager at_exit_; | 82 base::AtExitManager at_exit_; |
83 BrokerRpcServer rpc_server_; | |
82 }; | 84 }; |
83 | 85 |
84 CeeeBrokerModule module; | 86 CeeeBrokerModule module; |
85 | 87 |
86 extern "C" int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int nShowCmd) { | 88 extern "C" int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int nShowCmd) { |
87 return module.WinMain(nShowCmd); | 89 return module.WinMain(nShowCmd); |
88 } | 90 } |
89 | 91 |
90 CeeeBrokerModule::CeeeBrokerModule() | 92 CeeeBrokerModule::CeeeBrokerModule() |
91 : crash_reporter_(L"ceee_broker") { | 93 : crash_reporter_(L"ceee_broker") { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 // The above is best-effort, don't bail on error. | 153 // The above is best-effort, don't bail on error. |
152 return S_OK; | 154 return S_OK; |
153 } | 155 } |
154 | 156 |
155 HRESULT CeeeBrokerModule::PreMessageLoop(int show) { | 157 HRESULT CeeeBrokerModule::PreMessageLoop(int show) { |
156 // It's important to initialize the postman BEFORE we make the Broker | 158 // It's important to initialize the postman BEFORE we make the Broker |
157 // and the event funnel available, since we may get requests to execute | 159 // and the event funnel available, since we may get requests to execute |
158 // API invocation or Fire events before the postman is ready to handle them. | 160 // API invocation or Fire events before the postman is ready to handle them. |
159 chrome_postman_.Init(); | 161 chrome_postman_.Init(); |
160 WindowEventsFunnel::Initialize(); | 162 WindowEventsFunnel::Initialize(); |
163 | |
164 rpc_server_.Start(); | |
Sigurður Ásgeirsson
2010/11/12 14:40:24
Return error from the function on failure, as the
Vitaly Buka corp
2010/11/12 20:58:48
Done.
| |
165 DCHECK(rpc_server_.is_started()); | |
166 | |
161 return CAtlExeModuleT<CeeeBrokerModule>::PreMessageLoop(show); | 167 return CAtlExeModuleT<CeeeBrokerModule>::PreMessageLoop(show); |
162 } | 168 } |
163 | 169 |
164 HRESULT CeeeBrokerModule::PostMessageLoop() { | 170 HRESULT CeeeBrokerModule::PostMessageLoop() { |
165 HRESULT hr = CAtlExeModuleT<CeeeBrokerModule>::PostMessageLoop(); | 171 HRESULT hr = CAtlExeModuleT<CeeeBrokerModule>::PostMessageLoop(); |
166 Singleton<ExecutorsManager, | 172 Singleton<ExecutorsManager, |
167 ExecutorsManager::SingletonTraits>()->Terminate(); | 173 ExecutorsManager::SingletonTraits>()->Terminate(); |
168 WindowEventsFunnel::Terminate(); | 174 WindowEventsFunnel::Terminate(); |
169 chrome_postman_.Term(); | 175 chrome_postman_.Term(); |
170 return hr; | 176 return hr; |
(...skipping 14 matching lines...) Expand all Loading... | |
185 | 191 |
186 LONG LockModule() { | 192 LONG LockModule() { |
187 return module.LockModule(); | 193 return module.LockModule(); |
188 } | 194 } |
189 | 195 |
190 LONG UnlockModule() { | 196 LONG UnlockModule() { |
191 return module.UnlockModule(); | 197 return module.UnlockModule(); |
192 } | 198 } |
193 | 199 |
194 } // namespace | 200 } // namespace |
OLD | NEW |