| 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 // ChromePostman implementation. | 5 // ChromePostman implementation. | 
| 6 #include "ceee/ie/broker/chrome_postman.h" | 6 #include "ceee/ie/broker/chrome_postman.h" | 
| 7 | 7 | 
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" | 
| 9 #include "ceee/ie/broker/api_dispatcher.h" | 9 #include "ceee/ie/broker/api_dispatcher.h" | 
| 10 #include "ceee/ie/common/api_registration.h" | 10 #include "ceee/ie/common/api_registration.h" | 
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 237   DCHECK(ChromePostman::GetInstance() != NULL); | 237   DCHECK(ChromePostman::GetInstance() != NULL); | 
| 238   chrome_frame_host_->SetEventSink(ChromePostman::GetInstance()); | 238   chrome_frame_host_->SetEventSink(ChromePostman::GetInstance()); | 
| 239   chrome_frame_host_->SetChromeProfileName( | 239   chrome_frame_host_->SetChromeProfileName( | 
| 240       ceee_module_util::GetBrokerProfileNameForIe()); | 240       ceee_module_util::GetBrokerProfileNameForIe()); | 
| 241   hr = chrome_frame_host_->StartChromeFrame(); | 241   hr = chrome_frame_host_->StartChromeFrame(); | 
| 242   DCHECK(SUCCEEDED(hr)); | 242   DCHECK(SUCCEEDED(hr)); | 
| 243   if (FAILED(hr)) { | 243   if (FAILED(hr)) { | 
| 244     LOG(ERROR) << "Failed to start chrome frame " << com::LogHr(hr); | 244     LOG(ERROR) << "Failed to start chrome frame " << com::LogHr(hr); | 
| 245     return hr; | 245     return hr; | 
| 246   } | 246   } | 
|  | 247   // We need to pin the Chrome Frame DLL so that it doesn't get unloaded | 
|  | 248   // while we call CoUninitialize in our thread cleanup, otherwise we would | 
|  | 249   // get stuck on breakpad termination as filed in http://crbug.com/64388. | 
|  | 250   static bool s_pinned = false; | 
|  | 251   if (!s_pinned) { | 
|  | 252     HMODULE unused; | 
|  | 253     if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN, L"npchrome_frame.dll", | 
|  | 254                            &unused)) { | 
|  | 255       NOTREACHED() << "Failed to pin Chrome Frame. " << com::LogWe(); | 
|  | 256     } else { | 
|  | 257       s_pinned = true; | 
|  | 258     } | 
|  | 259   } | 
| 247   return hr; | 260   return hr; | 
| 248 } | 261 } | 
| 249 | 262 | 
| 250 HRESULT ChromePostman::ChromePostmanThread::CreateChromeFrameHost() { | 263 HRESULT ChromePostman::ChromePostmanThread::CreateChromeFrameHost() { | 
| 251   DCHECK(thread_id() == ::GetCurrentThreadId()); | 264   DCHECK(thread_id() == ::GetCurrentThreadId()); | 
| 252   return ChromeFrameHost::CreateInitializedIID(IID_IChromeFrameHost, | 265   return ChromeFrameHost::CreateInitializedIID(IID_IChromeFrameHost, | 
| 253                                                &chrome_frame_host_); | 266                                                &chrome_frame_host_); | 
| 254 } | 267 } | 
| 255 | 268 | 
| 256 void ChromePostman::ChromePostmanThread::CleanUp() { | 269 void ChromePostman::ChromePostmanThread::CleanUp() { | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 296 void ChromePostman::ApiInvocationWorkerThread::Init() { | 309 void ChromePostman::ApiInvocationWorkerThread::Init() { | 
| 297   ::CoInitializeEx(0, COINIT_MULTITHREADED); | 310   ::CoInitializeEx(0, COINIT_MULTITHREADED); | 
| 298   ProductionApiDispatcher::get()->SetApiInvocationThreadId( | 311   ProductionApiDispatcher::get()->SetApiInvocationThreadId( | 
| 299       ::GetCurrentThreadId()); | 312       ::GetCurrentThreadId()); | 
| 300 } | 313 } | 
| 301 | 314 | 
| 302 void ChromePostman::ApiInvocationWorkerThread::CleanUp() { | 315 void ChromePostman::ApiInvocationWorkerThread::CleanUp() { | 
| 303   ::CoUninitialize(); | 316   ::CoUninitialize(); | 
| 304   ProductionApiDispatcher::get()->SetApiInvocationThreadId(0); | 317   ProductionApiDispatcher::get()->SetApiInvocationThreadId(0); | 
| 305 } | 318 } | 
| OLD | NEW | 
|---|