summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 00:26:38 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 00:26:38 +0000
commit9eda5b7490cb3463435287b003058d6d486a83b3 (patch)
tree080cfabcb01256db1e2f3920cdbd1f4950752158
parentab6a5c4dd0c4a16b202567afa28f70c7ebd37ec9 (diff)
downloadchromium_src-9eda5b7490cb3463435287b003058d6d486a83b3.zip
chromium_src-9eda5b7490cb3463435287b003058d6d486a83b3.tar.gz
chromium_src-9eda5b7490cb3463435287b003058d6d486a83b3.tar.bz2
Ensure AutomationMsg_SetCookieAsync is sent on IO thread.
If SetCookie is invoked via automation and load_requests_via_automation is true, the IPC will be sent back from the UI thread. BUG=27568 Review URL: http://codereview.chromium.org/387042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31862 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_profile_impl.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.cc b/chrome/browser/automation/automation_profile_impl.cc
index 4d217d6..bb9b106 100644
--- a/chrome/browser/automation/automation_profile_impl.cc
+++ b/chrome/browser/automation/automation_profile_impl.cc
@@ -63,7 +63,7 @@ class AutomationCookieStore : public net::CookieStore {
if (cookie_set) {
// TODO(eroman): Should NOT be accessing the profile from here, as this
// is running on the IO thread.
- automation_client_->Send(new AutomationMsg_SetCookieAsync(0,
+ SendIPCMessageOnIOThread(new AutomationMsg_SetCookieAsync(0,
profile_->tab_handle(), url, cookie_line));
}
return cookie_set;
@@ -106,6 +106,16 @@ class AutomationCookieStore : public net::CookieStore {
}
protected:
+ void SendIPCMessageOnIOThread(IPC::Message* m) {
+ if (ChromeThread::CurrentlyOn(ChromeThread::IO)) {
+ automation_client_->Send(m);
+ } else {
+ Task* task = NewRunnableMethod(this,
+ &AutomationCookieStore::SendIPCMessageOnIOThread, m);
+ ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, task);
+ }
+ }
+
AutomationProfileImpl* profile_;
net::CookieStore* original_cookie_store_;
IPC::Message::Sender* automation_client_;