summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_thread.h
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 03:46:57 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 03:46:57 +0000
commitc1f50aa589d83b9725d4b7f19559eb94c006d818 (patch)
tree87f205ba59418713a3836e52040775ad9bb9fc13 /chrome/renderer/render_thread.h
parent4dd29e72c2c234fbffb0c6bf901ee8ccfb2f5637 (diff)
downloadchromium_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/render_thread.h')
-rw-r--r--chrome/renderer/render_thread.h41
1 files changed, 27 insertions, 14 deletions
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index 0336ba8..416b71b 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -92,26 +92,35 @@ class RenderThread : public RenderThreadBase,
// be accessed when running on the render thread itself
static RenderThread* current();
- // Overridden from RenderThreadBase.
- virtual bool Send(IPC::Message* msg) {
- return ChildThread::Send(msg);
- }
-
- virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) {
- widget_count_++;
- return ChildThread::AddRoute(routing_id, listener);
- }
- virtual void RemoveRoute(int32 routing_id) {
- widget_count_--;
- return ChildThread::RemoveRoute(routing_id);
- }
+ // Returns the routing ID of the RenderWidget containing the current script
+ // execution context (corresponding to WebFrame::frameForCurrentContext).
+ static int32 RoutingIDForCurrentContext();
+ // Overridden from RenderThreadBase.
+ virtual bool Send(IPC::Message* msg);
+ virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener);
+ virtual void RemoveRoute(int32 routing_id);
virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter);
virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter);
-
virtual void WidgetHidden();
virtual void WidgetRestored();
+ // Send a synchronous message and run a nested message loop, while waiting
+ // for a reply.
+ //
+ // NOTE: Only use this method if the handler for the message may need to show
+ // UI before replying.
+ //
+ bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
+
+ // These methods modify how the next message is sent. Normally, when sending
+ // a synchronous message that runs a nested message loop, we need to suspend
+ // callbacks into WebKit. This involves disabling timers and deferring
+ // resource loads. However, there are exceptions when we need to customize
+ // the behavior.
+ void DoNotSuspendWebKitSharedTimer();
+ void DoNotNotifyWebKitOfModalLoop();
+
VisitedLinkSlave* visited_link_slave() const {
return visited_link_slave_.get();
}
@@ -255,6 +264,10 @@ class RenderThread : public RenderThreadBase,
// True if this renderer is running extensions.
bool is_extension_process_;
+ bool do_not_suspend_webkit_shared_timer_;
+ bool do_not_notify_webkit_of_modal_loop_;
+ bool did_notify_webkit_of_modal_loop_;
+
// Timer that periodically calls IdleHandler.
base::RepeatingTimer<RenderThread> idle_timer_;