diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 01:31:31 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-19 01:31:31 +0000 |
commit | a5205b632e1c520ab58109ca36a1d4fdaa520478 (patch) | |
tree | ea91a2e932adee4dd28631e1d64e0184c3692a91 | |
parent | b09ee61ce290342d4aaff122a170e775dbc9d770 (diff) | |
download | chromium_src-a5205b632e1c520ab58109ca36a1d4fdaa520478.zip chromium_src-a5205b632e1c520ab58109ca36a1d4fdaa520478.tar.gz chromium_src-a5205b632e1c520ab58109ca36a1d4fdaa520478.tar.bz2 |
Fix the ChromeFrame new window popup test by ensuring that CreateExternalTabComplete executes on the IPC thread as before
and InitializeComplete executes as a task on the UI thread. The test failed because we receive IPCs for the new tab before
we have a tab proxy for it.
To fix the crash in bug http://code.google.com/p/chromium/issues/detail?id=44245, we set the automation_server_ member to NULL
after ReleaseAutomationServer returns. There are a number of races related to the automation server being released which
should hopefully go away if we remove dependency on the AutomationProxy object. Added a TODO to that effect in the code.
Bug=44245
Review URL: http://codereview.chromium.org/2079012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47612 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome_frame/chrome_frame_automation.cc | 12 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.h | 5 | ||||
-rw-r--r-- | chrome_frame/custom_sync_call_context.h | 8 |
3 files changed, 12 insertions, 13 deletions
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index d4bca94..257e20b 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -832,8 +832,6 @@ void ChromeFrameAutomationClient::CreateExternalTabComplete(HWND chrome_window, tab_->AddObserver(this); tab_handle_ = tab_handle; } - - InitializeComplete(launch_result); } void ChromeFrameAutomationClient::SetEnableExtensionAutomation( @@ -1100,19 +1098,21 @@ void ChromeFrameAutomationClient::ReleaseAutomationServer() { // calling ReleaseAutomationServer. The reason we do this is that // we must cancel pending messages before we release the automation server. // Furthermore, while ReleaseAutomationServer is running, we could get - // a callback to LaunchComplete which is where we normally get our pointer - // to the automation server and there we check the server id for NULLness - // and do nothing if it is NULL. + // a callback to LaunchComplete which could cause an external tab to be + // created. Ideally the callbacks should be dropped. + // TODO(ananta) + // Refactor the ChromeFrameAutomationProxy code to not depend on + // AutomationProxy and simplify the whole mess. void* server_id = automation_server_id_; automation_server_id_ = NULL; if (automation_server_) { // Make sure to clean up any pending sync messages before we go away. automation_server_->CancelAsync(this); - automation_server_ = NULL; } proxy_factory_->ReleaseAutomationServer(server_id); + automation_server_ = NULL; // automation_server_ must not have been set to non NULL. // (if this regresses, start by looking at LaunchComplete()). diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h index 3461eba2..78e1d30 100644 --- a/chrome_frame/chrome_frame_automation.h +++ b/chrome_frame/chrome_frame_automation.h @@ -273,10 +273,6 @@ class ChromeFrameAutomationClient // For IDeleteBrowsingHistorySupport void RemoveBrowsingData(int remove_mask); - ChromeFrameAutomationProxy* automation_server() { - return automation_server_; - } - protected: // ChromeFrameAutomationProxy::LaunchDelegate implementation. virtual void LaunchComplete(ChromeFrameAutomationProxy* proxy, @@ -316,6 +312,7 @@ class ChromeFrameAutomationClient void* automation_server_id_; ChromeFrameAutomationProxy* automation_server_; + HWND chrome_window_; scoped_refptr<TabProxy> tab_; ChromeFrameDelegate* chrome_frame_delegate_; diff --git a/chrome_frame/custom_sync_call_context.h b/chrome_frame/custom_sync_call_context.h index fcb786a..c9242d6 100644 --- a/chrome_frame/custom_sync_call_context.h +++ b/chrome_frame/custom_sync_call_context.h @@ -90,10 +90,12 @@ class CreateExternalTabContext } void Completed(HWND chrome_window, HWND tab_window, int tab_handle) { + client_->CreateExternalTabComplete(chrome_window, tab_window, tab_handle); client_->PostTask(FROM_HERE, - NewRunnableMethod(client_.get(), - &ChromeFrameAutomationClient::CreateExternalTabComplete, - chrome_window, tab_window, tab_handle)); + NewRunnableMethod( + client_.get(), + &ChromeFrameAutomationClient::InitializeComplete, + AUTOMATION_SUCCESS)); } private: |