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_webstoragearea_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_webstoragearea_impl.cc')
-rw-r--r-- | chrome/renderer/renderer_webstoragearea_impl.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/chrome/renderer/renderer_webstoragearea_impl.cc b/chrome/renderer/renderer_webstoragearea_impl.cc index 20ce740..e1a9fb9 100644 --- a/chrome/renderer/renderer_webstoragearea_impl.cc +++ b/chrome/renderer/renderer_webstoragearea_impl.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "chrome/renderer/renderer_webstoragearea_impl.h" @@ -9,10 +9,12 @@ #include "chrome/renderer/render_view.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "third_party/WebKit/WebKit/chromium/public/WebView.h" using WebKit::WebFrame; using WebKit::WebString; using WebKit::WebURL; +using WebKit::WebView; RendererWebStorageAreaImpl::RendererWebStorageAreaImpl( int64 namespace_id, const WebString& origin) { @@ -48,18 +50,18 @@ WebString RendererWebStorageAreaImpl::getItem(const WebString& key) { void RendererWebStorageAreaImpl::setItem( const WebString& key, const WebString& value, const WebURL& url, WebStorageArea::Result& result, WebString& old_value_webkit) { + int32 routing_id = RenderThread::RoutingIDForCurrentContext(); + CHECK(routing_id != MSG_ROUTING_CONTROL); + NullableString16 old_value; - RenderThread::current()->Send( - new ViewHostMsg_DOMStorageSetItem(storage_area_id_, key, value, url, - &result, &old_value)); + RenderThread::current()->SendAndRunNestedMessageLoop( + new ViewHostMsg_DOMStorageSetItem(routing_id, storage_area_id_, key, + value, url, &result, &old_value)); old_value_webkit = old_value; if (result == WebStorageArea::ResultBlockedByPolicy) { - RenderView* view = - RenderView::FromWebView(WebFrame::frameForCurrentContext()->view()); - DCHECK(view); RenderThread::current()->Send(new ViewHostMsg_ContentBlocked( - view->routing_id(), CONTENT_SETTINGS_TYPE_COOKIES)); + routing_id, CONTENT_SETTINGS_TYPE_COOKIES)); } } |