diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-22 11:33:05 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-22 11:33:05 +0000 |
commit | b4b967edacf8e291f78df2c8238e3446922a179f (patch) | |
tree | 621b8c0eedf48e7cb346f31277ce3b34a30cb99a | |
parent | 57b4ef12d0f726a79a3fa023cd6bb32b51925be8 (diff) | |
download | chromium_src-b4b967edacf8e291f78df2c8238e3446922a179f.zip chromium_src-b4b967edacf8e291f78df2c8238e3446922a179f.tar.gz chromium_src-b4b967edacf8e291f78df2c8238e3446922a179f.tar.bz2 |
DevTools: Run nested message loop instead of whitelisting the messages.
Review URL: http://codereview.chromium.org/90007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14183 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/devtools_agent.cc | 12 | ||||
-rw-r--r-- | chrome/renderer/devtools_agent.h | 2 | ||||
-rw-r--r-- | chrome/renderer/devtools_agent_filter.cc | 112 | ||||
-rw-r--r-- | chrome/renderer/devtools_agent_filter.h | 10 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_widget.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/render_widget.h | 3 | ||||
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.cc | 72 | ||||
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.h | 9 | ||||
-rw-r--r-- | webkit/glue/devtools/debugger_agent_manager.cc | 33 | ||||
-rw-r--r-- | webkit/glue/devtools/debugger_agent_manager.h | 11 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent.h | 9 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_delegate.h | 3 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 9 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.h | 2 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 10 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 3 |
17 files changed, 175 insertions, 131 deletions
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc index 918bb73..88528b2 100644 --- a/chrome/renderer/devtools_agent.cc +++ b/chrome/renderer/devtools_agent.cc @@ -26,6 +26,7 @@ DevToolsAgent::~DevToolsAgent() { bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message) + IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement) @@ -45,6 +46,10 @@ int DevToolsAgent::GetHostId() { return routing_id_; } +void DevToolsAgent::ForceRepaint() { + view_->GenerateFullRepaint(); +} + // static DevToolsAgent* DevToolsAgent::FromHostId(int host_id) { std::map<int, DevToolsAgent*>::iterator it = @@ -55,6 +60,13 @@ DevToolsAgent* DevToolsAgent::FromHostId(int host_id) { return NULL; } +void DevToolsAgent::OnAttach() { + WebDevToolsAgent* web_agent = GetWebAgent(); + if (web_agent) { + web_agent->Attach(); + } +} + void DevToolsAgent::OnDetach() { WebDevToolsAgent* web_agent = GetWebAgent(); if (web_agent) { diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h index 9f813a3..2c2702c 100644 --- a/chrome/renderer/devtools_agent.h +++ b/chrome/renderer/devtools_agent.h @@ -32,6 +32,7 @@ class DevToolsAgent : public WebDevToolsAgentDelegate { // WebDevToolsAgentDelegate implementation virtual void SendMessageToClient(const std::string& raw_msg); virtual int GetHostId(); + virtual void ForceRepaint(); // Returns agent instance for its host id. static DevToolsAgent* FromHostId(int host_id); @@ -43,6 +44,7 @@ class DevToolsAgent : public WebDevToolsAgentDelegate { private: friend class DevToolsAgentFilter; + void OnAttach(); void OnDetach(); void OnRpcMessage(const std::string& raw_msg); void OnInspectElement(int x, int y); diff --git a/chrome/renderer/devtools_agent_filter.cc b/chrome/renderer/devtools_agent_filter.cc index ec7dd1c7..13b76f4 100644 --- a/chrome/renderer/devtools_agent_filter.cc +++ b/chrome/renderer/devtools_agent_filter.cc @@ -5,6 +5,7 @@ #include "chrome/renderer/devtools_agent_filter.h" #include "base/command_line.h" +#include "base/message_loop.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/devtools_messages.h" #include "chrome/renderer/devtools_agent.h" @@ -12,37 +13,24 @@ #include "chrome/renderer/render_view.h" #include "webkit/glue/webdevtoolsagent.h" -namespace { - -class DebuggerMessage : public WebDevToolsAgent::Message { - public: - DebuggerMessage(int routing_id, const IPC::Message& message) - : routing_id_(routing_id), - message_(message) { - } - - virtual void Dispatch() { - DevToolsAgent* agent = DevToolsAgent::FromHostId(routing_id_); - if (agent) { - agent->OnMessageReceived(message_); - } - } - - private: - int routing_id_; - IPC::Message message_; - DISALLOW_COPY_AND_ASSIGN(DebuggerMessage); -}; - -} // namespace - -std::set<int> DevToolsAgentFilter::attached_routing_ids_; +// static +void DevToolsAgentFilter::DispatchMessageLoop() { + MessageLoop* current = MessageLoop::current(); + bool old_state = current->NestableTasksAllowed(); + current->SetNestableTasksAllowed(true); + current->RunAllPending(); + current->SetNestableTasksAllowed(old_state); +} DevToolsAgentFilter::DevToolsAgentFilter() : current_routing_id_(0) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); devtools_enabled_ = command_line.HasSwitch( switches::kEnableOutOfProcessDevTools); + if (devtools_enabled_) { + WebDevToolsAgent::SetMessageLoopDispatchHandler( + &DevToolsAgentFilter::DispatchMessageLoop); + } } DevToolsAgentFilter::~DevToolsAgentFilter() { @@ -52,84 +40,18 @@ bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) { if (!devtools_enabled_) { return false; } - if (message.type() < DevToolsAgentStart || - message.type() >= DevToolsAgentEnd) { - return false; - } - - int routing_id = message.routing_id(); - - MessageLoop* view_loop = RenderThread::current()->message_loop(); - if (attached_routing_ids_.find(routing_id) == attached_routing_ids_.end()) { - // Agent has not been scheduled for attachment yet. - // Schedule attach command, no matter which one is actually being - // dispatched. - view_loop->PostTask(FROM_HERE, NewRunnableMethod( - this, - &DevToolsAgentFilter::Attach, - message.routing_id())); - attached_routing_ids_.insert(routing_id); - -#if defined(OS_WIN) - // Disable plugin message routing. - PluginChannelHost::SetListening(false); -#endif - } - - // If this is attach request - we are done. - if (message.type() == DevToolsAgentMsg_Attach::ID) { - return true; - } - if (message.type() == DevToolsAgentMsg_Detach::ID) { - // We are about to schedule detach. - attached_routing_ids_.erase(routing_id); - if (attached_routing_ids_.size() == 0) { -#if defined(OS_WIN) - // All the agents are scheduled for detach -> resume dispatching - // of plugin messages. - PluginChannelHost::SetListening(true); -#endif - } - } - - if (message.type() != DevToolsAgentMsg_DebuggerCommand::ID) { - // Dispatch everything except for command through the debugger interrupt. - DebuggerMessage* m = new DebuggerMessage(routing_id, message); - WebDevToolsAgent::ScheduleMessageDispatch(m); - view_loop->PostTask( - FROM_HERE, - NewRunnableMethod( - this, - &DevToolsAgentFilter::EvalNoop, - routing_id)); - return true; - } else { + if (message.type() == DevToolsAgentMsg_DebuggerCommand::ID) { // Dispatch command directly from IO. bool handled = true; - current_routing_id_ = routing_id; + current_routing_id_ = message.routing_id(); IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; - } -} - -void DevToolsAgentFilter::EvalNoop(int routing_id) { - DevToolsAgent* agent = DevToolsAgent::FromHostId(routing_id); - if (agent) { - agent->render_view()->EvaluateScript(L"", L"javascript:void(0)"); - } -} - -void DevToolsAgentFilter::Attach(int routing_id) { - DevToolsAgent* agent = DevToolsAgent::FromHostId(routing_id); - if (agent) { - WebDevToolsAgent* web_agent = agent->GetWebAgent(); - if (web_agent) { - web_agent->Attach(); - } + } else { + return false; } } diff --git a/chrome/renderer/devtools_agent_filter.h b/chrome/renderer/devtools_agent_filter.h index f97e4a3..662b863 100644 --- a/chrome/renderer/devtools_agent_filter.h +++ b/chrome/renderer/devtools_agent_filter.h @@ -28,18 +28,12 @@ class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter { // IPC::ChannelProxy::MessageFilter override. Called on IO thread. virtual bool OnMessageReceived(const IPC::Message& message); + static void DispatchMessageLoop(); + // OnDebuggerCommand will be executed in the IO thread so that we can // handle debug messages even when v8 is stopped. void OnDebuggerCommand(const std::string& command); - // Evaluates noop to kick the debugger. - void EvalNoop(int routing_id); - - // Attaches agent. - void Attach(int routing_id); - - static std::set<int> attached_routing_ids_; - int current_routing_id_; bool devtools_enabled_; diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 771fa8a..56528e4 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -360,6 +360,8 @@ void RenderView::OnMessageReceived(const IPC::Message& message) { // If this is developer tools renderer intercept tools messages first. if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) return; + if (devtools_agent_.get() && devtools_agent_->OnMessageReceived(message)) + return; IPC_BEGIN_MESSAGE_MAP(RenderView, message) IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, SendThumbnail) diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 7f698cf..4cd54c1 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -595,6 +595,10 @@ void RenderWidget::CloseWidgetSoon(WebWidget* webwidget) { Send(new ViewHostMsg_Close(routing_id_)); } +void RenderWidget::GenerateFullRepaint() { + DidInvalidateRect(webwidget_, gfx::Rect(size_.width(), size_.height())); +} + void RenderWidget::Close() { if (webwidget_) { webwidget_->Close(); diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index 9dbfcbb..668b4fd 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -90,6 +90,9 @@ class RenderWidget : public IPC::Channel::Listener, virtual bool IsHidden(WebWidget* webwidget) { return is_hidden_; } virtual WebKit::WebScreenInfo GetScreenInfo(WebWidget* webwidget); + // Invalidates entire widget rect to generate a full repaint. + void GenerateFullRepaint(); + // Close the underlying WebWidget. void Close(); diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc index 88fc171..03f8ba7 100644 --- a/webkit/glue/devtools/debugger_agent_impl.cc +++ b/webkit/glue/devtools/debugger_agent_impl.cc @@ -4,8 +4,15 @@ #include "config.h" +#include <wtf/HashSet.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + #include "Document.h" +#include "Frame.h" #include "Node.h" +#include "Page.h" +#include "PageGroup.h" #undef LOG #include "grit/webkit_resources.h" @@ -16,12 +23,16 @@ #include "webkit/glue/devtools/debugger_agent_impl.h" #include "webkit/glue/devtools/debugger_agent_manager.h" #include "webkit/glue/glue_util.h" +#include "webkit/glue/webdevtoolsagent_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webview_impl.h" using WebCore::DOMWindow; using WebCore::Document; +using WebCore::Frame; using WebCore::Node; +using WebCore::Page; +using WebCore::PageGroup; using WebCore::String; using WebCore::V8ClassIndex; using WebCore::V8Custom; @@ -40,6 +51,7 @@ DebuggerAgentImpl::DebuggerAgentImpl( DebuggerAgentImpl::~DebuggerAgentImpl() { DebuggerAgentManager::DebugDetach(this); + web_view_impl_->SetIgnoreInputEvents(false); } void DebuggerAgentImpl::DebugBreak() { @@ -48,6 +60,8 @@ void DebuggerAgentImpl::DebugBreak() { void DebuggerAgentImpl::DebuggerOutput(const std::string& command) { delegate_->DebuggerOutput(command); + // TODO(pfeldman): Uncomment this once v8 changes are landed. + // webdevtools_agent_->ForceRepaint(); } void DebuggerAgentImpl::SetDocument(Document* document) { @@ -129,6 +143,64 @@ String DebuggerAgentImpl::ExecuteUtilityFunction( return WebCore::toWebCoreString(res_json); } +void DebuggerAgentImpl::RunWithDeferredMessages( + const HashSet<DebuggerAgentImpl*>& agents, + WebDevToolsAgent::MessageLoopDispatchHandler handler) { + + // TODO(pfeldman): Make PageGroupLoadDeferrer visible and use it from here. + // Code below is derived from the Chrome.cpp's PageGroupLoadDeferrer: + // 1. Disable active objects and input events. + Vector<RefPtr<Frame>, 16> deferred_frames; + for (HashSet<DebuggerAgentImpl*>::const_iterator ag_it = agents.begin(); + ag_it != agents.end(); ++ag_it) { + DebuggerAgentImpl* agent = *ag_it; + agent->web_view()->SetIgnoreInputEvents(true); + const HashSet<Page*>& pages = agent->GetPage()->group().pages(); + HashSet<Page*>::const_iterator end = pages.end(); + for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { + Page* other_page = *it; + if (!other_page->defersLoading()) { + deferred_frames.append(other_page->mainFrame()); +#if !PLATFORM(MAC) + for (Frame* frame = other_page->mainFrame(); frame; + frame = frame->tree()->traverseNext()) { + frame->document()->suspendActiveDOMObjects(); + } +#endif + } + } + } + + // 2. Disable loading. + size_t count = deferred_frames.size(); + for (size_t i = 0; i < count; ++i) { + if (Page* page = deferred_frames[i]->page()) { + page->setDefersLoading(true); + } + } + // 3. Process messages. + handler(); + + // 4. Bring things back. + for (size_t i = 0; i < deferred_frames.size(); ++i) { + if (Page* page = deferred_frames[i]->page()) { + page->setDefersLoading(false); + +#if !PLATFORM(MAC) + for (Frame* frame = page->mainFrame(); frame; frame = + frame->tree()->traverseNext()) { + frame->document()->resumeActiveDOMObjects(); + } +#endif + } + } + + for (HashSet<DebuggerAgentImpl*>::const_iterator ag_it = agents.begin(); + ag_it != agents.end(); ++ag_it) { + (*ag_it)->web_view()->SetIgnoreInputEvents(false); + } +} + WebCore::Page* DebuggerAgentImpl::GetPage() { return web_view_impl_->page(); } diff --git a/webkit/glue/devtools/debugger_agent_impl.h b/webkit/glue/devtools/debugger_agent_impl.h index acce569..c1d3cb1 100644 --- a/webkit/glue/devtools/debugger_agent_impl.h +++ b/webkit/glue/devtools/debugger_agent_impl.h @@ -5,8 +5,11 @@ #ifndef WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_ #define WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_ +#include <wtf/HashSet.h> + #include "v8.h" #include "webkit/glue/devtools/debugger_agent.h" +#include "webkit/glue/webdevtoolsagent.h" class WebDevToolsAgentImpl; class WebViewImpl; @@ -41,9 +44,15 @@ class DebuggerAgentImpl : public DebuggerAgent { WebCore::Node* node, const WebCore::String& json_args); + static void RunWithDeferredMessages( + const HashSet<DebuggerAgentImpl*>& agents, + WebDevToolsAgent::MessageLoopDispatchHandler handler); + WebCore::Page* GetPage(); WebDevToolsAgentImpl* webdevtools_agent() { return webdevtools_agent_; }; + WebViewImpl* web_view() { return web_view_impl_; } + private: v8::Persistent<v8::Context> context_; WebViewImpl* web_view_impl_; diff --git a/webkit/glue/devtools/debugger_agent_manager.cc b/webkit/glue/devtools/debugger_agent_manager.cc index ef37b7d..907dd76 100644 --- a/webkit/glue/devtools/debugger_agent_manager.cc +++ b/webkit/glue/devtools/debugger_agent_manager.cc @@ -21,6 +21,8 @@ #include "v8/include/v8-debug.h" #endif +WebDevToolsAgent::MessageLoopDispatchHandler + DebuggerAgentManager::message_loop_dispatch_handler_ = NULL; // static void DebuggerAgentManager::V8DebugMessageHandler(const uint16_t* message, @@ -33,13 +35,13 @@ void DebuggerAgentManager::V8DebugMessageHandler(const uint16_t* message, #endif } -void DebuggerAgentManager::V8DebugHostDispatchHandler( - void* dispatch, - void* data) { - WebDevToolsAgent::Message* m = - reinterpret_cast<WebDevToolsAgent::Message*>(dispatch); - m->Dispatch(); - delete m; +void DebuggerAgentManager::V8DebugHostDispatchHandler() { + if (DebuggerAgentManager::message_loop_dispatch_handler_ + && attached_agents_) { + DebuggerAgentImpl::RunWithDeferredMessages( + *attached_agents_, + message_loop_dispatch_handler_); + } } // static @@ -53,11 +55,10 @@ void DebuggerAgentManager::DebugAttach(DebuggerAgentImpl* debugger_agent) { attached_agents_ = new AttachedAgentsSet(); v8::Debug::SetMessageHandler( &DebuggerAgentManager::V8DebugMessageHandler, - NULL, /* no additional data */ false /* don't create separate thread for sending debugger output */); - v8::Debug::SetHostDispatchHandler( - &DebuggerAgentManager::V8DebugHostDispatchHandler, - NULL /* no additional data */); + // TODO(pfeldman): Uncomment once V8 changes are landed. +// v8::Debug::SetHostDispatchHandler( +// &DebuggerAgentManager::V8DebugHostDispatchHandler, 100 /* ms */); } attached_agents_->add(debugger_agent); #endif @@ -165,7 +166,6 @@ bool DebuggerAgentManager::SendCommandResponse(DictionaryValue* response) { return true; } - // static void DebuggerAgentManager::ExecuteDebuggerCommand( const std::string& command, @@ -178,11 +178,9 @@ void DebuggerAgentManager::ExecuteDebuggerCommand( } // static -void DebuggerAgentManager::ScheduleMessageDispatch( - WebDevToolsAgent::Message* message) { -#if USE(V8) - v8::Debug::SendHostDispatch(message); -#endif +void DebuggerAgentManager::SetMessageLoopDispatchHandler( + WebDevToolsAgent::MessageLoopDispatchHandler handler) { + message_loop_dispatch_handler_ = handler; } // static @@ -193,7 +191,6 @@ void DebuggerAgentManager::SendCommandToV8(const std::wstring& cmd) { #endif } - // static DebuggerAgentImpl* DebuggerAgentManager::FindAgentForCurrentV8Context() { if (!attached_agents_) { diff --git a/webkit/glue/devtools/debugger_agent_manager.h b/webkit/glue/devtools/debugger_agent_manager.h index 42f03cc..390ecc2 100644 --- a/webkit/glue/devtools/debugger_agent_manager.h +++ b/webkit/glue/devtools/debugger_agent_manager.h @@ -39,10 +39,8 @@ class DebuggerAgentManager { static void ExecuteDebuggerCommand(const std::string& command, int caller_id); - - // Requests that debugger makes a callback on the render thread while on - // breakpoint. - static void ScheduleMessageDispatch(WebDevToolsAgent::Message* message); + static void SetMessageLoopDispatchHandler( + WebDevToolsAgent::MessageLoopDispatchHandler handler); private: DebuggerAgentManager(); @@ -51,7 +49,7 @@ class DebuggerAgentManager { static void V8DebugMessageHandler(const uint16_t* message, int length, void* data); - static void V8DebugHostDispatchHandler(void* dispatch, void* data); + static void V8DebugHostDispatchHandler(); static void DebuggerOutput(const std::string& out); static void SendCommandToV8(const std::wstring& cmd); static bool SendCommandResponse(DictionaryValue* response); @@ -67,6 +65,9 @@ class DebuggerAgentManager { typedef HashSet<DebuggerAgentImpl*> AttachedAgentsSet; static AttachedAgentsSet* attached_agents_; + static WebDevToolsAgent::MessageLoopDispatchHandler + message_loop_dispatch_handler_; + DISALLOW_COPY_AND_ASSIGN(DebuggerAgentManager); }; diff --git a/webkit/glue/webdevtoolsagent.h b/webkit/glue/webdevtoolsagent.h index 049964b..9680e84 100644 --- a/webkit/glue/webdevtoolsagent.h +++ b/webkit/glue/webdevtoolsagent.h @@ -37,9 +37,12 @@ class WebDevToolsAgent { static void ExecuteDebuggerCommand(const std::string& command, int caller_id); - // Requests that debugger makes a callback on the render thread while on - // breakpoint. Takes ownership of message. - static void ScheduleMessageDispatch(Message* message); + typedef void (*MessageLoopDispatchHandler)(); + + // Installs dispatch handle that is going to be called periodically + // while on a breakpoint. + static void SetMessageLoopDispatchHandler( + MessageLoopDispatchHandler handler); private: DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgent); diff --git a/webkit/glue/webdevtoolsagent_delegate.h b/webkit/glue/webdevtoolsagent_delegate.h index 4112e4f..5c596ff 100644 --- a/webkit/glue/webdevtoolsagent_delegate.h +++ b/webkit/glue/webdevtoolsagent_delegate.h @@ -15,6 +15,9 @@ class WebDevToolsAgentDelegate { virtual void SendMessageToClient(const std::string& raw_msg) = 0; + // Invalidates widget which leads to the repaint. + virtual void ForceRepaint() = 0; + // Returns the id of the entity hosting this agent. virtual int GetHostId() = 0; diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index 11c64764..769a477 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -154,6 +154,10 @@ void WebDevToolsAgentImpl::AddMessageToConsole( } } +void WebDevToolsAgentImpl::ForceRepaint() { + delegate_->ForceRepaint(); +} + void WebDevToolsAgentImpl::HighlightDOMNode(int node_id) { if (!attached_) { return; @@ -252,6 +256,7 @@ void WebDevToolsAgent::ExecuteDebuggerCommand( } // static -void WebDevToolsAgent::ScheduleMessageDispatch(Message* message) { - DebuggerAgentManager::ScheduleMessageDispatch(message); +void WebDevToolsAgent::SetMessageLoopDispatchHandler( + MessageLoopDispatchHandler handler) { + DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); } diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h index 232e8e3..4a3c9ea 100644 --- a/webkit/glue/webdevtoolsagent_impl.h +++ b/webkit/glue/webdevtoolsagent_impl.h @@ -71,6 +71,8 @@ class WebDevToolsAgentImpl const WebCore::String& source_id, unsigned int line_no); + void ForceRepaint(); + int host_id() { return host_id_; } NetAgentImpl* net_agent_impl() { return net_agent_impl_.get(); } diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index e974d44..9906a27 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -358,6 +358,7 @@ WebViewImpl::WebViewImpl() zoom_level_(0), context_menu_allowed_(false), doing_drag_and_drop_(false), + ignore_input_events_(false), suppress_next_keypress_event_(false), window_open_disposition_(IGNORE_ACTION), ime_accept_events_(true), @@ -1018,6 +1019,10 @@ bool WebViewImpl::HandleInputEvent(const WebInputEvent* input_event) { // we're done. if (doing_drag_and_drop_) return true; + + if (ignore_input_events_) + return true; + // TODO(eseidel): Remove g_current_input_event. // This only exists to allow ChromeClient::show() to know which mouse button // triggered a window.open event. @@ -1881,6 +1886,11 @@ void WebViewImpl::HideAutoCompletePopup() { } } +void WebViewImpl::SetIgnoreInputEvents(bool new_value) { + DCHECK(ignore_input_events_ != new_value); + ignore_input_events_ = new_value; +} + WebCore::Node* WebViewImpl::GetNodeForWindowPos(int x, int y) { HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y)); return result.innerNonSharedNode(); diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 9080bf4..71a5a86 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -120,6 +120,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { const std::vector<std::wstring>& suggestions, int default_suggestion_index); virtual void HideAutofillPopup(); + virtual void SetIgnoreInputEvents(bool new_value); virtual WebDevToolsAgent* GetWebDevToolsAgent(); WebDevToolsAgentImpl* GetWebDevToolsAgentImpl(); @@ -304,6 +305,8 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { bool doing_drag_and_drop_; + bool ignore_input_events_; + // Webkit expects keyPress events to be suppressed if the associated keyDown // event was handled. Safari implements this behavior by peeking out the // associated WM_CHAR event if the keydown was handled. We emulate |