Skip to content

Commit

Permalink
Merge r187114 - Make PluginProxy::handleMouseEvent() asynchronous.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=146142

Patch by Sungmann Cho <sungmann.cho@navercorp.com> on 2015-07-21
Reviewed by Anders Carlsson.

PluginProxy::handleMouseEvent() forwards the generated mouse event to PluginControllerProxy
using a synchronous message, but the recipient always reply immediately with the same value("true")
even before handling the received message. So I think PluginProxy::handleMouseEvent() is perfectly
OK to process its messages asynchronously.

Source/WebKit2:

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::handleMouseEvent):
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/PluginControllerProxy.messages.in:
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::handleMouseEvent):

LayoutTests:

platform/mac-wk2/plugins/mouse-events-expected.txt was introduced by webkit.org/b/116665 to avoid
flakey tests, but from now on we can share the common expectations.

* platform/mac-wk2/plugins/mouse-events-expected.txt: Removed.
  • Loading branch information
chosungmann authored and carlosgcampos committed Aug 4, 2015
1 parent 13d234e commit 7190549
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 29 deletions.
17 changes: 17 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
2015-07-21 Sungmann Cho <sungmann.cho@navercorp.com>

Make PluginProxy::handleMouseEvent() asynchronous.
https://bugs.webkit.org/show_bug.cgi?id=146142

Reviewed by Anders Carlsson.

PluginProxy::handleMouseEvent() forwards the generated mouse event to PluginControllerProxy
using a synchronous message, but the recipient always reply immediately with the same value("true")
even before handling the received message. So I think PluginProxy::handleMouseEvent() is perfectly
OK to process its messages asynchronously.

platform/mac-wk2/plugins/mouse-events-expected.txt was introduced by webkit.org/b/116665 to avoid
flakey tests, but from now on we can share the common expectations.

* platform/mac-wk2/plugins/mouse-events-expected.txt: Removed.

2015-07-19 Jordan Harband <ljharb@gmail.com>

new Date(NaN).toJSON() must return null instead of throwing a TypeError
Expand Down
12 changes: 0 additions & 12 deletions LayoutTests/platform/mac-wk2/plugins/mouse-events-expected.txt

This file was deleted.

19 changes: 19 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,22 @@
2015-07-21 Sungmann Cho <sungmann.cho@navercorp.com>

Make PluginProxy::handleMouseEvent() asynchronous.
https://bugs.webkit.org/show_bug.cgi?id=146142

Reviewed by Anders Carlsson.

PluginProxy::handleMouseEvent() forwards the generated mouse event to PluginControllerProxy
using a synchronous message, but the recipient always reply immediately with the same value("true")
even before handling the received message. So I think PluginProxy::handleMouseEvent() is perfectly
OK to process its messages asynchronously.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::handleMouseEvent):
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/PluginControllerProxy.messages.in:
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::handleMouseEvent):

2015-07-20 Tim Horton <timothy_horton@apple.com>

REGRESSION (r174287): Flash of black when opening a new web view or navigating to a new page
Expand Down
12 changes: 2 additions & 10 deletions Source/WebKit2/PluginProcess/PluginControllerProxy.cpp
Expand Up @@ -527,17 +527,9 @@ void PluginControllerProxy::manualStreamDidFail(bool wasCancelled)

m_plugin->manualStreamDidFail(wasCancelled);
}

void PluginControllerProxy::handleMouseEvent(const WebMouseEvent& mouseEvent, PassRefPtr<Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply> reply)
{
// Always let the web process think that we've handled this mouse event, even before passing it along to the plug-in.
// This is a workaround for
// <rdar://problem/9299901> UI process thinks the page is unresponsive when a plug-in is showing a context menu.
// The web process sends a synchronous HandleMouseEvent message and the plug-in process spawns a nested
// run loop when showing the context menu, so eventually the unresponsiveness timer kicks in in the UI process.
// FIXME: We should come up with a better way to do this.
reply->send(true);

void PluginControllerProxy::handleMouseEvent(const WebMouseEvent& mouseEvent)
{
m_plugin->handleMouseEvent(mouseEvent);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/PluginProcess/PluginControllerProxy.h
Expand Up @@ -136,7 +136,7 @@ class PluginControllerProxy : PluginController {
void manualStreamDidReceiveData(const IPC::DataReference& data);
void manualStreamDidFinishLoading();
void manualStreamDidFail(bool wasCancelled);
void handleMouseEvent(const WebMouseEvent&, PassRefPtr<Messages::PluginControllerProxy::HandleMouseEvent::DelayedReply>);
void handleMouseEvent(const WebMouseEvent&);
void handleWheelEvent(const WebWheelEvent&, bool& handled);
void handleMouseEnterEvent(const WebMouseEvent&, bool& handled);
void handleMouseLeaveEvent(const WebMouseEvent&, bool& handled);
Expand Down
Expand Up @@ -63,7 +63,7 @@ messages -> PluginControllerProxy LegacyReceiver {
ManualStreamDidFail(bool wasCancelled)

# Sent when a mouse event (that isn't a mouse enter/leave event or a wheel event) should be processed.
HandleMouseEvent(WebKit::WebMouseEvent mouseEvent) -> (bool handled) Delayed
HandleMouseEvent(WebKit::WebMouseEvent mouseEvent)

# Sent when a mouse wheel event should be processed.
HandleWheelEvent(WebKit::WebWheelEvent wheelEvent) -> (bool handled)
Expand Down
7 changes: 2 additions & 5 deletions Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp
Expand Up @@ -367,11 +367,8 @@ bool PluginProxy::handleMouseEvent(const WebMouseEvent& mouseEvent)
if (m_waitingOnAsynchronousInitialization)
return false;

bool handled = false;
if (!m_connection->connection()->sendSync(Messages::PluginControllerProxy::HandleMouseEvent(mouseEvent), Messages::PluginControllerProxy::HandleMouseEvent::Reply(handled), m_pluginInstanceID))
return false;

return handled;
m_connection->connection()->send(Messages::PluginControllerProxy::HandleMouseEvent(mouseEvent), m_pluginInstanceID);
return true;
}

bool PluginProxy::handleWheelEvent(const WebWheelEvent& wheelEvent)
Expand Down

0 comments on commit 7190549

Please sign in to comment.