| 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 #include "chrome_frame/chrome_frame_automation.h" | 5 #include "chrome_frame/chrome_frame_automation.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 NOTREACHED(); | 122 NOTREACHED(); |
| 123 } | 123 } |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl( | 128 ChromeFrameAutomationProxyImpl::ChromeFrameAutomationProxyImpl( |
| 129 AutomationProxyCacheEntry* entry, | 129 AutomationProxyCacheEntry* entry, |
| 130 std::string channel_id, int launch_timeout) | 130 std::string channel_id, int launch_timeout) |
| 131 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) { | 131 : AutomationProxy(launch_timeout, false), proxy_entry_(entry) { |
| 132 TRACE_EVENT_BEGIN("chromeframe.automationproxy", this, ""); | 132 TRACE_EVENT_BEGIN_ETW("chromeframe.automationproxy", this, ""); |
| 133 | 133 |
| 134 InitializeChannel(channel_id, false); | 134 InitializeChannel(channel_id, false); |
| 135 | 135 |
| 136 sync_ = new CFMsgDispatcher(); | 136 sync_ = new CFMsgDispatcher(); |
| 137 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get()); | 137 message_filter_ = new TabProxyNotificationMessageFilter(tracker_.get()); |
| 138 | 138 |
| 139 // Order of filters is not important. | 139 // Order of filters is not important. |
| 140 channel_->AddFilter(message_filter_.get()); | 140 channel_->AddFilter(message_filter_.get()); |
| 141 channel_->AddFilter(sync_.get()); | 141 channel_->AddFilter(sync_.get()); |
| 142 } | 142 } |
| 143 | 143 |
| 144 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() { | 144 ChromeFrameAutomationProxyImpl::~ChromeFrameAutomationProxyImpl() { |
| 145 TRACE_EVENT_END("chromeframe.automationproxy", this, ""); | 145 TRACE_EVENT_END_ETW("chromeframe.automationproxy", this, ""); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ChromeFrameAutomationProxyImpl::SendAsAsync( | 148 void ChromeFrameAutomationProxyImpl::SendAsAsync( |
| 149 IPC::SyncMessage* msg, | 149 IPC::SyncMessage* msg, |
| 150 SyncMessageReplyDispatcher::SyncMessageCallContext* context, void* key) { | 150 SyncMessageReplyDispatcher::SyncMessageCallContext* context, void* key) { |
| 151 sync_->Push(msg, context, key); | 151 sync_->Push(msg, context, key); |
| 152 channel_->ChannelProxy::Send(msg); | 152 channel_->ChannelProxy::Send(msg); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void ChromeFrameAutomationProxyImpl::CancelAsync(void* key) { | 155 void ChromeFrameAutomationProxyImpl::CancelAsync(void* key) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 "ChromeFrame.AutomationServerLaunchFailedTime", delta); | 347 "ChromeFrame.AutomationServerLaunchFailedTime", delta); |
| 348 } | 348 } |
| 349 | 349 |
| 350 UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchResult", | 350 UMA_HISTOGRAM_CUSTOM_COUNTS("ChromeFrame.LaunchResult", |
| 351 launch_result_, | 351 launch_result_, |
| 352 AUTOMATION_SUCCESS, | 352 AUTOMATION_SUCCESS, |
| 353 AUTOMATION_CREATE_TAB_FAILED, | 353 AUTOMATION_CREATE_TAB_FAILED, |
| 354 AUTOMATION_CREATE_TAB_FAILED + 1); | 354 AUTOMATION_CREATE_TAB_FAILED + 1); |
| 355 } | 355 } |
| 356 | 356 |
| 357 TRACE_EVENT_END("chromeframe.createproxy", this, ""); | 357 TRACE_EVENT_END_ETW("chromeframe.createproxy", this, ""); |
| 358 | 358 |
| 359 // Finally set the proxy. | 359 // Finally set the proxy. |
| 360 proxy_.reset(proxy); | 360 proxy_.reset(proxy); |
| 361 launch_delegates_.push_back(delegate); | 361 launch_delegates_.push_back(delegate); |
| 362 | 362 |
| 363 delegate->LaunchComplete(proxy_.get(), launch_result_); | 363 delegate->LaunchComplete(proxy_.get(), launch_result_); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void AutomationProxyCacheEntry::RemoveDelegate(LaunchDelegate* delegate, | 366 void AutomationProxyCacheEntry::RemoveDelegate(LaunchDelegate* delegate, |
| 367 base::WaitableEvent* done, | 367 base::WaitableEvent* done, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 DWORD result = proxies_[i]->WaitForThread(0); | 460 DWORD result = proxies_[i]->WaitForThread(0); |
| 461 if (WAIT_OBJECT_0 != result) | 461 if (WAIT_OBJECT_0 != result) |
| 462 // TODO(stoyan): Don't leak proxies on exit. | 462 // TODO(stoyan): Don't leak proxies on exit. |
| 463 DLOG(ERROR) << "Proxies leaked on exit."; | 463 DLOG(ERROR) << "Proxies leaked on exit."; |
| 464 } | 464 } |
| 465 } | 465 } |
| 466 | 466 |
| 467 void ProxyFactory::GetAutomationServer( | 467 void ProxyFactory::GetAutomationServer( |
| 468 LaunchDelegate* delegate, ChromeFrameLaunchParams* params, | 468 LaunchDelegate* delegate, ChromeFrameLaunchParams* params, |
| 469 void** automation_server_id) { | 469 void** automation_server_id) { |
| 470 TRACE_EVENT_BEGIN("chromeframe.createproxy", this, ""); | 470 TRACE_EVENT_BEGIN_ETW("chromeframe.createproxy", this, ""); |
| 471 | 471 |
| 472 scoped_refptr<AutomationProxyCacheEntry> entry; | 472 scoped_refptr<AutomationProxyCacheEntry> entry; |
| 473 // Find already existing launcher thread for given profile | 473 // Find already existing launcher thread for given profile |
| 474 base::AutoLock lock(lock_); | 474 base::AutoLock lock(lock_); |
| 475 for (size_t i = 0; i < proxies_.container().size(); ++i) { | 475 for (size_t i = 0; i < proxies_.container().size(); ++i) { |
| 476 if (proxies_[i]->IsSameProfile(params->profile_name())) { | 476 if (proxies_[i]->IsSameProfile(params->profile_name())) { |
| 477 entry = proxies_[i]; | 477 entry = proxies_[i]; |
| 478 break; | 478 break; |
| 479 } | 479 } |
| 480 } | 480 } |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 const net::URLRequestStatus& status) { | 1351 const net::URLRequestStatus& status) { |
| 1352 automation_server_->Send(new AutomationMsg_RequestEnd( | 1352 automation_server_->Send(new AutomationMsg_RequestEnd( |
| 1353 tab_->handle(), request_id, status)); | 1353 tab_->handle(), request_id, status)); |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1356 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
| 1357 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1357 const GURL& url, const std::string& cookie_string, int cookie_id) { |
| 1358 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse( | 1358 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse( |
| 1359 tab_->handle(), success, url, cookie_string, cookie_id)); | 1359 tab_->handle(), success, url, cookie_string, cookie_id)); |
| 1360 } | 1360 } |
| OLD | NEW |