diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 03:46:57 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 03:46:57 +0000 |
commit | c1f50aa589d83b9725d4b7f19559eb94c006d818 (patch) | |
tree | 87f205ba59418713a3836e52040775ad9bb9fc13 /chrome/renderer/renderer_webkitclient_impl.cc | |
parent | 4dd29e72c2c234fbffb0c6bf901ee8ccfb2f5637 (diff) | |
download | chromium_src-c1f50aa589d83b9725d4b7f19559eb94c006d818.zip chromium_src-c1f50aa589d83b9725d4b7f19559eb94c006d818.tar.gz chromium_src-c1f50aa589d83b9725d4b7f19559eb94c006d818.tar.bz2 |
Modal loops of joy.
We need to pump messages in the renderer and in any related plugin processes
when sending sync IPCs to get cookies and set localstorage items because these
IPCs can block on a user prompt.
This code moves complexity into RenderThread::Send(). That function is now
responsible for calling WebView::{willEnter,didExit}ModalLoop() and for
broadcasting the messages to signal/reset modal dialog events in the related
plugin processes.
This change also adds code to optionally suspend the shared webkit timer. This
was needed to fix bug 36063. It also helps make spinning a nested loop to wait
for document.cookie results a bit less risky since we'll be re-entering WebKit
in fewer cases.
R=jam
BUG=34917,36063
TEST=none
Review URL: http://codereview.chromium.org/607011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39327 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/renderer_webkitclient_impl.cc')
-rw-r--r-- | chrome/renderer/renderer_webkitclient_impl.cc | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index 504d8f3..a475616 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -116,13 +116,7 @@ void RendererWebKitClientImpl::setCookies(const WebURL& url, const WebString& value) { // TODO(darin): Modify WebKit to pass the WebFrame. This code may be reached // when there is no active script context. - int routing_id = MSG_ROUTING_CONTROL; - if (v8::Context::InContext()) { - RenderView* view = - RenderView::FromWebView(WebFrame::frameForCurrentContext()->view()); - DCHECK(view); - routing_id = view->routing_id(); - } + int32 routing_id = RenderThread::RoutingIDForCurrentContext(); std::string value_utf8; UTF16ToUTF8(value.data(), value.length(), &value_utf8); @@ -133,9 +127,15 @@ void RendererWebKitClientImpl::setCookies(const WebURL& url, WebString RendererWebKitClientImpl::cookies( const WebURL& url, const WebURL& first_party_for_cookies) { + // TODO(darin): Modify WebKit to pass the WebFrame. This code may be reached + // when there is no active script context. + int32 routing_id = RenderThread::RoutingIDForCurrentContext(); + std::string value_utf8; - RenderThread::current()->Send( - new ViewHostMsg_GetCookies(url, first_party_for_cookies, &value_utf8)); + RenderThread::current()->SendAndRunNestedMessageLoop( + new ViewHostMsg_GetCookies(routing_id, url, first_party_for_cookies, + &value_utf8)); + return WebString::fromUTF8(value_utf8); } @@ -143,9 +143,15 @@ bool RendererWebKitClientImpl::rawCookies( const WebURL& url, const WebURL& first_party_for_cookies, WebVector<WebKit::WebCookie>* raw_cookies) { + // TODO(darin): Modify WebKit to pass the WebFrame. This code may be reached + // when there is no active script context. + int32 routing_id = RenderThread::RoutingIDForCurrentContext(); + std::vector<webkit_glue::WebCookie> cookies; - RenderThread::current()->Send( - new ViewHostMsg_GetRawCookies(url, first_party_for_cookies, &cookies)); + RenderThread::current()->SendAndRunNestedMessageLoop( + new ViewHostMsg_GetRawCookies(routing_id, url, first_party_for_cookies, + &cookies)); + WebVector<WebKit::WebCookie> result(cookies.size()); int i = 0; |