From 56ee0b56f44f89ab3475756fb95ad98e5e3dbfa1 Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Sat, 24 Oct 2009 17:55:02 +0000 Subject: Hopefully the last of the fixes to get Chrome Frame tests going again. 1. Added a check in the OnDestroy handler for the ChromeFrame ActiveX as to whether the worker thread is valid before posting a task to it. 2. Added a helper function in ChromeFrameAutomationClient to support asynchronous host network stack requests deletion. If this does not work I will revert the previous CL's. TBR=amit Review URL: http://codereview.chromium.org/338010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30010 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/chrome_frame_activex_base.h | 12 +++++++----- chrome_frame/chrome_frame_automation.cc | 15 +++++++++++++++ chrome_frame/chrome_frame_automation.h | 3 +++ 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'chrome_frame') diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index f4a276e..85432ef 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -505,11 +505,13 @@ END_MSG_MAP() LRESULT OnDestroy(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { // NO_LINT - worker_thread_.message_loop()->PostTask( - FROM_HERE, NewRunnableMethod(this, &Base::OnWorkerStop)); - if (automation_client_.get()) - automation_client_->CleanupRequests(); - worker_thread_.Stop(); + if (worker_thread_.message_loop()) { + worker_thread_.message_loop()->PostTask( + FROM_HERE, NewRunnableMethod(this, &Base::OnWorkerStop)); + if (automation_client_.get()) + automation_client_->CleanupAsyncRequests(); + worker_thread_.Stop(); + } return 0; } diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index ecbca0c..4529ca3 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -1049,6 +1049,21 @@ void ChromeFrameAutomationClient::CleanupRequests() { request_map_.clear(); } +void ChromeFrameAutomationClient::CleanupAsyncRequests() { + RequestMap::iterator index = request_map_.begin(); + while (index != request_map_.end()) { + PluginUrlRequest* request = (*index).second; + if (request) { + int request_id = request->id(); + request->Stop(); + } + index++; + } + + DCHECK(request_map_.empty()); + request_map_.clear(); +} + bool ChromeFrameAutomationClient::Reinitialize( ChromeFrameDelegate* delegate) { if (!tab_.get() || !::IsWindow(chrome_window_)) { diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h index f2120e2..411fdb8 100644 --- a/chrome_frame/chrome_frame_automation.h +++ b/chrome_frame/chrome_frame_automation.h @@ -240,6 +240,9 @@ class ChromeFrameAutomationClient PluginUrlRequest* LookupRequest(int request_id) const; bool IsValidRequest(PluginUrlRequest* request) const; void CleanupRequests(); + // For IE the host network stack requests are issued on a separate thread, + // which requires the requests to be cleaned up asynchronously. + void CleanupAsyncRequests(); void set_use_chrome_network(bool use_chrome_network) { use_chrome_network_ = use_chrome_network; -- cgit v1.1