Skip to content

Commit

Permalink
Out of process plug-ins are never asked to initially paint
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=47993
<rdar://problem/8570342>

Reviewed by Darin Adler.

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction):
Add new callMemberFunction overload.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::paintEntirePlugin):
Set the dirty rect to be the entire plug-in rect and then paint the plug-in.

* PluginProcess/PluginControllerProxy.messages.in:
Add PaintEntirePlugin message.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::PluginProxy):
Initialize m_pluginBackingStoreContainsValidData to false.

(WebKit::PluginProxy::paint):
If m_pluginBackingStoreContainsValidData is false, synchronously ask the plug-in to paint,
then blit the plug-in backing store into our own backing store.

(WebKit::PluginProxy::geometryDidChange):
Set m_pluginBackingStoreContainsValidData to false.

(WebKit::PluginProxy::update):
Set m_pluginBackingStoreContainsValidData to true if the plug-in has painted its entire area.

Canonical link: https://commits.webkit.org/60713@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70162 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Oct 20, 2010
1 parent b688d87 commit baee402
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 0 deletions.
33 changes: 33 additions & 0 deletions WebKit2/ChangeLog
@@ -1,3 +1,36 @@
2010-10-20 Anders Carlsson <andersca@apple.com>

Reviewed by Darin Adler.

Out of process plug-ins are never asked to initially paint
https://bugs.webkit.org/show_bug.cgi?id=47993
<rdar://problem/8570342>

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction):
Add new callMemberFunction overload.

* PluginProcess/PluginControllerProxy.cpp:
(WebKit::PluginControllerProxy::paintEntirePlugin):
Set the dirty rect to be the entire plug-in rect and then paint the plug-in.

* PluginProcess/PluginControllerProxy.messages.in:
Add PaintEntirePlugin message.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::PluginProxy):
Initialize m_pluginBackingStoreContainsValidData to false.

(WebKit::PluginProxy::paint):
If m_pluginBackingStoreContainsValidData is false, synchronously ask the plug-in to paint,
then blit the plug-in backing store into our own backing store.

(WebKit::PluginProxy::geometryDidChange):
Set m_pluginBackingStoreContainsValidData to false.

(WebKit::PluginProxy::update):
Set m_pluginBackingStoreContainsValidData to true if the plug-in has painted its entire area.

2010-10-19 Jessie Berlin <jberlin@apple.com>

Reviewed by Geoffrey Garen.
Expand Down
6 changes: 6 additions & 0 deletions WebKit2/Platform/CoreIPC/HandleMessage.h
Expand Up @@ -55,6 +55,12 @@ void callMemberFunction(const Arguments7<P1, P2, P3, P4, P5, P6, P7>& args, C* o

// Dispatch functions with reply arguments.

template<typename C, typename MF>
void callMemberFunction(const Arguments0&, Arguments0&, C* object, MF function)
{
(object->*function)();
}

template<typename C, typename MF, typename R1>
void callMemberFunction(const Arguments0&, Arguments1<R1>& replyArgs, C* object, MF function)
{
Expand Down
7 changes: 7 additions & 0 deletions WebKit2/PluginProcess/PluginControllerProxy.cpp
Expand Up @@ -86,6 +86,7 @@ void PluginControllerProxy::destroy()
void PluginControllerProxy::paint()
{
ASSERT(!m_dirtyRect.isEmpty());
m_paintTimer.stop();

if (!m_backingStore)
return;
Expand Down Expand Up @@ -291,6 +292,12 @@ void PluginControllerProxy::handleKeyboardEvent(const WebKeyboardEvent& keyboard
handled = m_plugin->handleKeyboardEvent(keyboardEvent);
}

void PluginControllerProxy::paintEntirePlugin()
{
m_dirtyRect = m_frameRect;
paint();
}

void PluginControllerProxy::setFocus(bool hasFocus)
{
m_plugin->setFocus(hasFocus);
Expand Down
1 change: 1 addition & 0 deletions WebKit2/PluginProcess/PluginControllerProxy.h
Expand Up @@ -94,6 +94,7 @@ class PluginControllerProxy : PluginController {
void handleMouseEnterEvent(const WebMouseEvent&, bool& handled);
void handleMouseLeaveEvent(const WebMouseEvent&, bool& handled);
void handleKeyboardEvent(const WebKeyboardEvent&, bool& handled);
void paintEntirePlugin();
void setFocus(bool);
void didUpdate();
#if PLATFORM(MAC)
Expand Down
3 changes: 3 additions & 0 deletions WebKit2/PluginProcess/PluginControllerProxy.messages.in
Expand Up @@ -62,6 +62,9 @@ messages -> PluginControllerProxy {
# Sent when the update requested by Update has been painted.
DidUpdate()

# Paint the entire plug-in.
PaintEntirePlugin() -> ()

#if PLATFORM(MAC)
# Sent when the containing NSWindow's focus changes
WindowFocusChanged(bool hasFocus)
Expand Down
17 changes: 17 additions & 0 deletions WebKit2/WebProcess/Plugins/PluginProxy.cpp
Expand Up @@ -57,6 +57,7 @@ PluginProxy::PluginProxy(PassRefPtr<PluginProcessConnection> connection)
: m_connection(connection)
, m_pluginInstanceID(generatePluginInstanceID())
, m_pluginController(0)
, m_pluginBackingStoreContainsValidData(false)
, m_isStarted(false)
, m_waitingForPaintInResponseToUpdate(false)
{
Expand Down Expand Up @@ -113,6 +114,17 @@ void PluginProxy::paint(GraphicsContext* graphicsContext, const IntRect& dirtyRe
if (!m_backingStore)
return;

if (!m_pluginBackingStoreContainsValidData) {
m_connection->connection()->sendSync(Messages::PluginControllerProxy::PaintEntirePlugin(), Messages::PluginControllerProxy::PaintEntirePlugin::Reply(), m_pluginInstanceID, CoreIPC::Connection::NoTimeout);

// Blit the plug-in backing store into our own backing store.
OwnPtr<WebCore::GraphicsContext> graphicsContext = m_backingStore->createGraphicsContext();

m_pluginBackingStore->paint(graphicsContext.get(), IntRect(0, 0, m_frameRect.width(), m_frameRect.height()));

m_pluginBackingStoreContainsValidData = true;
}

IntRect dirtyRectInPluginCoordinates = dirtyRect;
dirtyRectInPluginCoordinates.move(-m_frameRect.x(), -m_frameRect.y());

Expand Down Expand Up @@ -169,6 +181,8 @@ void PluginProxy::geometryDidChange(const IntRect& frameRect, const IntRect& cli
m_pluginBackingStore.clear();
return;
}

m_pluginBackingStoreContainsValidData = false;
}

m_connection->connection()->send(Messages::PluginControllerProxy::GeometryDidChange(frameRect, clipRect, pluginBackingStoreHandle), m_pluginInstanceID);
Expand Down Expand Up @@ -345,6 +359,9 @@ void PluginProxy::setCookiesForURL(const String& urlString, const String& cookie

void PluginProxy::update(const IntRect& paintedRect)
{
if (paintedRect == m_frameRect)
m_pluginBackingStoreContainsValidData = true;

IntRect paintedRectPluginCoordinates = paintedRect;
paintedRectPluginCoordinates.move(-m_frameRect.x(), -m_frameRect.y());

Expand Down
3 changes: 3 additions & 0 deletions WebKit2/WebProcess/Plugins/PluginProxy.h
Expand Up @@ -112,6 +112,9 @@ class PluginProxy : public Plugin {
// This is the shared memory backing store that the plug-in paints into. When the plug-in tells us
// that it's painted something in it, we'll blit from it to our own backing store.
RefPtr<BackingStore> m_pluginBackingStore;

// Whether all of the plug-in backing store contains valid data.
bool m_pluginBackingStoreContainsValidData;

bool m_isStarted;

Expand Down

0 comments on commit baee402

Please sign in to comment.