summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/surface/accelerated_surface_mac.cc10
-rw-r--r--app/surface/accelerated_surface_mac.h8
-rw-r--r--chrome/browser/gpu_process_host.cc17
-rw-r--r--chrome/browser/gpu_process_host.h3
-rw-r--r--chrome/browser/renderer_host/accelerated_surface_container_mac.cc14
-rw-r--r--chrome/browser/renderer_host/accelerated_surface_container_mac.h5
-rw-r--r--chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc4
-rw-r--r--chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h2
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc4
-rw-r--r--chrome/browser/renderer_host/render_widget_host.h3
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view.h2
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.h3
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm4
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.cc4
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.h5
-rw-r--r--chrome/common/gpu_messages_internal.h5
-rw-r--r--chrome/common/plugin_messages_internal.h7
-rw-r--r--chrome/common/render_messages_internal.h7
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.cc6
-rw-r--r--chrome/plugin/command_buffer_stub.cc4
-rw-r--r--chrome/plugin/webplugin_accelerated_surface_proxy_mac.cc3
-rw-r--r--chrome/plugin/webplugin_proxy.cc5
-rw-r--r--chrome/plugin/webplugin_proxy.h3
-rw-r--r--chrome/renderer/render_view.cc5
-rw-r--r--chrome/renderer/render_view.h3
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc4
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h3
-rw-r--r--gpu/command_buffer/service/gpu_processor.h2
-rw-r--r--gpu/command_buffer/service/gpu_processor_mac.cc6
29 files changed, 104 insertions, 47 deletions
diff --git a/app/surface/accelerated_surface_mac.cc b/app/surface/accelerated_surface_mac.cc
index c081f4d..dfe9281 100644
--- a/app/surface/accelerated_surface_mac.cc
+++ b/app/surface/accelerated_surface_mac.cc
@@ -12,7 +12,8 @@
#include "gfx/rect.h"
AcceleratedSurface::AcceleratedSurface()
- : allocate_fbo_(false),
+ : io_surface_id_(0),
+ allocate_fbo_(false),
texture_(0),
fbo_(0),
depth_stencil_renderbuffer_(0) {
@@ -266,7 +267,12 @@ uint64 AcceleratedSurface::SetSurfaceSize(const gfx::Size& size) {
// make our IOSurfaces global and send back their identifiers. On
// the browser process side the identifier is reconstituted into an
// IOSurface for on-screen rendering.
- return io_surface_support->IOSurfaceGetID(io_surface_);
+ io_surface_id_ = io_surface_support->IOSurfaceGetID(io_surface_);
+ return io_surface_id_;
+}
+
+uint64 AcceleratedSurface::GetSurfaceId() {
+ return io_surface_id_;
}
TransportDIB::Handle AcceleratedSurface::SetTransportDIBSize(
diff --git a/app/surface/accelerated_surface_mac.h b/app/surface/accelerated_surface_mac.h
index a111c14..a43effa 100644
--- a/app/surface/accelerated_surface_mac.h
+++ b/app/surface/accelerated_surface_mac.h
@@ -58,6 +58,10 @@ class AcceleratedSurface {
// occurred. MakeCurrent() will have been called on the new surface.
uint64 SetSurfaceSize(const gfx::Size& size);
+ // Returns the id of this surface's IOSruface, or 0 for
+ // transport DIB surfaces.
+ uint64 GetSurfaceId();
+
// Sets the GL context to be the current one for drawing. Returns true if
// it succeeded.
bool MakeCurrent();
@@ -131,6 +135,10 @@ class AcceleratedSurface {
// TODO(dspringer,kbr): Should the GPU backing store be encapsulated in its
// own class so all this implementation detail is hidden?
base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_;
+
+ // The id of |io_surface_| or 0 if that's NULL.
+ uint64 io_surface_id_;
+
// TODO(dspringer): If we end up keeping this TransportDIB mechanism, this
// should really be a scoped_ptr_malloc<>, with a deallocate functor that
// runs |dib_free_callback_|. I was not able to figure out how to
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index be62820..158a65f 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -309,10 +309,14 @@ namespace {
class BuffersSwappedDispatcher : public Task {
public:
BuffersSwappedDispatcher(
- int32 renderer_id, int32 render_view_id, gfx::PluginWindowHandle window)
+ int32 renderer_id,
+ int32 render_view_id,
+ gfx::PluginWindowHandle window,
+ uint64 surface_id)
: renderer_id_(renderer_id),
render_view_id_(render_view_id),
- window_(window) {
+ window_(window),
+ surface_id_(surface_id) {
}
void Run() {
@@ -323,13 +327,14 @@ class BuffersSwappedDispatcher : public Task {
RenderWidgetHostView* view = host->view();
if (!view)
return;
- view->AcceleratedSurfaceBuffersSwapped(window_);
+ view->AcceleratedSurfaceBuffersSwapped(window_, surface_id_);
}
private:
int32 renderer_id_;
int32 render_view_id_;
gfx::PluginWindowHandle window_;
+ uint64 surface_id_;
DISALLOW_COPY_AND_ASSIGN(BuffersSwappedDispatcher);
};
@@ -339,10 +344,12 @@ class BuffersSwappedDispatcher : public Task {
void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
int32 renderer_id,
int32 render_view_id,
- gfx::PluginWindowHandle window) {
+ gfx::PluginWindowHandle window,
+ uint64 surface_id) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- new BuffersSwappedDispatcher(renderer_id, render_view_id, window));
+ new BuffersSwappedDispatcher(
+ renderer_id, render_view_id, window, surface_id));
}
#endif
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 0e14402..de8d3e5 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -102,7 +102,8 @@ class GpuProcessHost : public BrowserChildProcessHost {
const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params);
void OnAcceleratedSurfaceBuffersSwapped(int32 renderer_id,
int32 render_view_id,
- gfx::PluginWindowHandle window);
+ gfx::PluginWindowHandle window,
+ uint64 surface_id);
#endif
void ReplyToRenderer(const IPC::ChannelHandle& channel,
diff --git a/chrome/browser/renderer_host/accelerated_surface_container_mac.cc b/chrome/browser/renderer_host/accelerated_surface_container_mac.cc
index 8d7ce75..ca2a600 100644
--- a/chrome/browser/renderer_host/accelerated_surface_container_mac.cc
+++ b/chrome/browser/renderer_host/accelerated_surface_container_mac.cc
@@ -14,6 +14,7 @@ AcceleratedSurfaceContainerMac::AcceleratedSurfaceContainerMac(
bool opaque)
: manager_(manager),
opaque_(opaque),
+ surface_id_(0),
width_(0),
height_(0),
texture_(0),
@@ -31,10 +32,13 @@ void AcceleratedSurfaceContainerMac::SetSizeAndIOSurface(
int32 height,
uint64 io_surface_identifier) {
surface_.reset();
+ surface_id_ = 0;
IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize();
if (io_surface_support) {
surface_.reset(io_surface_support->IOSurfaceLookup(
static_cast<uint32>(io_surface_identifier)));
+ if (surface_.get())
+ surface_id_ = io_surface_identifier;
EnqueueTextureForDeletion();
width_ = width;
height_ = height;
@@ -192,6 +196,16 @@ void AcceleratedSurfaceContainerMac::Draw(CGLContextObj context) {
}
}
+void AcceleratedSurfaceContainerMac::set_was_painted_to(uint64 surface_id) {
+ if (surface_id) {
+ // Check that only the most current IOSurface allocated for this container
+ // is painted to.
+ DCHECK(surface_);
+ DCHECK_EQ(surface_id, surface_id_);
+ }
+ was_painted_to_ = true;
+}
+
void AcceleratedSurfaceContainerMac::EnqueueTextureForDeletion() {
if (texture_) {
DCHECK(texture_pending_deletion_ == 0);
diff --git a/chrome/browser/renderer_host/accelerated_surface_container_mac.h b/chrome/browser/renderer_host/accelerated_surface_container_mac.h
index 04742f3..de6ceb8 100644
--- a/chrome/browser/renderer_host/accelerated_surface_container_mac.h
+++ b/chrome/browser/renderer_host/accelerated_surface_container_mac.h
@@ -77,7 +77,7 @@ class AcceleratedSurfaceContainerMac {
void ForceTextureReload() { texture_needs_upload_ = true; }
// Notifies the surface that it was painted to.
- void set_was_painted_to() { was_painted_to_ = true; }
+ void set_was_painted_to(uint64 surface_id);
// Returns if the surface should be shown.
bool should_be_visible() const { return visible_ && was_painted_to_; }
@@ -94,6 +94,9 @@ class AcceleratedSurfaceContainerMac {
// IOSurfaceRef type when building on 10.5.
base::mac::ScopedCFTypeRef<CFTypeRef> surface_;
+ // The id of |surface_|, or 0 if |surface_| is NULL.
+ uint64 surface_id_;
+
// The TransportDIB which is used in pre-10.6 systems where the IOSurface
// API is not supported. This is a weak reference to the actual TransportDIB
// whic is owned by the GPU process.
diff --git a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc
index 8e8a17e..3755474 100644
--- a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc
+++ b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc
@@ -124,12 +124,12 @@ void AcceleratedSurfaceContainerManagerMac::ForceTextureReload() {
}
void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo(
- gfx::PluginWindowHandle id) {
+ gfx::PluginWindowHandle id, uint64 surface_id) {
AutoLock lock(lock_);
AcceleratedSurfaceContainerMac* container = MapIDToContainer(id);
if (container)
- container->set_was_painted_to();
+ container->set_was_painted_to(surface_id);
}
bool AcceleratedSurfaceContainerManagerMac::SurfaceShouldBeVisible(
diff --git a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h
index 0e38c11..1f5e0a7 100644
--- a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h
+++ b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h
@@ -74,7 +74,7 @@ class AcceleratedSurfaceContainerManagerMac {
void ForceTextureReload();
// Notifies a surface that it has been painted to.
- void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id);
+ void SetSurfaceWasPaintedTo(gfx::PluginWindowHandle id, uint64 surface_id);
// Returns if a given surface should be shown.
bool SurfaceShouldBeVisible(gfx::PluginWindowHandle id) const;
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index e426041..9d89fd8 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -1045,9 +1045,9 @@ void RenderWidgetHost::OnAcceleratedSurfaceSetTransportDIB(
}
void RenderWidgetHost::OnAcceleratedSurfaceBuffersSwapped(
- gfx::PluginWindowHandle window) {
+ gfx::PluginWindowHandle window, uint64 surface_id) {
if (view_) {
- view_->AcceleratedSurfaceBuffersSwapped(window);
+ view_->AcceleratedSurfaceBuffersSwapped(window, surface_id);
}
}
#elif defined(OS_POSIX)
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index a914a40..fe8ad85 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -511,7 +511,8 @@ class RenderWidgetHost : public IPC::Channel::Listener,
int32 width,
int32 height,
TransportDIB::Handle transport_dib);
- void OnAcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window);
+ void OnAcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
+ uint64 surface_id);
#elif defined(OS_POSIX)
void OnMsgCreatePluginContainer(gfx::PluginWindowHandle id);
void OnMsgDestroyPluginContainer(gfx::PluginWindowHandle id);
diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h
index c13fd70..352de02 100644
--- a/chrome/browser/renderer_host/render_widget_host_view.h
+++ b/chrome/browser/renderer_host/render_widget_host_view.h
@@ -229,7 +229,7 @@ class RenderWidgetHostView {
int32 height,
TransportDIB::Handle transport_dib) = 0;
virtual void AcceleratedSurfaceBuffersSwapped(
- gfx::PluginWindowHandle window) = 0;
+ gfx::PluginWindowHandle window, uint64 surface_id) = 0;
virtual void GpuRenderingStateDidChange() = 0;
#endif
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h
index 6efa36a..b448a8a 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h
@@ -244,7 +244,8 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
int32 width,
int32 height,
TransportDIB::Handle transport_dib);
- virtual void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window);
+ virtual void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
+ uint64 surface_id);
virtual void GpuRenderingStateDidChange();
void DrawAcceleratedSurfaceInstance(
CGLContextObj context,
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 68435a2..9c1b17a 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -913,7 +913,7 @@ void RenderWidgetHostViewMac::AcceleratedSurfaceSetTransportDIB(
}
void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped(
- gfx::PluginWindowHandle window) {
+ gfx::PluginWindowHandle window, uint64 surface_id) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
PluginViewMap::iterator it = plugin_views_.find(window);
DCHECK(plugin_views_.end() != it);
@@ -922,7 +922,7 @@ void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped(
}
DCHECK([it->second isKindOfClass:[AcceleratedPluginView class]]);
- plugin_container_manager_.SetSurfaceWasPaintedTo(window);
+ plugin_container_manager_.SetSurfaceWasPaintedTo(window, surface_id);
AcceleratedPluginView* view =
static_cast<AcceleratedPluginView*>(it->second);
// The surface is hidden until its first paint, to not show gargabe.
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc
index ecc2426..fb201bc 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.cc
+++ b/chrome/browser/renderer_host/test/test_render_view_host.cc
@@ -167,7 +167,7 @@ void TestRenderWidgetHostView::AcceleratedSurfaceSetIOSurface(
gfx::PluginWindowHandle window,
int32 width,
int32 height,
- uint64 io_surface_identifier) {
+ uint64 surface_id) {
}
void TestRenderWidgetHostView::AcceleratedSurfaceSetTransportDIB(
@@ -178,7 +178,7 @@ void TestRenderWidgetHostView::AcceleratedSurfaceSetTransportDIB(
}
void TestRenderWidgetHostView::AcceleratedSurfaceBuffersSwapped(
- gfx::PluginWindowHandle window) {
+ gfx::PluginWindowHandle window, uint64 surface_id) {
}
void TestRenderWidgetHostView::GpuRenderingStateDidChange() {
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h
index 034e100..f33e7ff 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.h
+++ b/chrome/browser/renderer_host/test/test_render_view_host.h
@@ -112,13 +112,14 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
virtual void AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window,
int32 width,
int32 height,
- uint64 io_surface_identifier);
+ uint64 surface_id);
virtual void AcceleratedSurfaceSetTransportDIB(
gfx::PluginWindowHandle window,
int32 width,
int32 height,
TransportDIB::Handle transport_dib);
- virtual void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window);
+ virtual void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
+ uint64 surface_id);
virtual void GpuRenderingStateDidChange();
#endif
virtual void SetVisuallyDeemphasized(bool deemphasized) { }
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index 184d8f4..0b8e3e6 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -142,10 +142,11 @@ IPC_BEGIN_MESSAGES(GpuHost)
// This message notifies the browser process that the renderer
// swapped the buffers associated with the given "window", which
// should cause the browser to redraw the compositor's contents.
- IPC_MESSAGE_CONTROL3(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
+ IPC_MESSAGE_CONTROL4(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
int32, /* renderer_id */
int32, /* render_view_id */
- gfx::PluginWindowHandle /* window */)
+ gfx::PluginWindowHandle /* window */,
+ uint64 /* surface_id */)
#endif
IPC_END_MESSAGES(GpuHost)
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index a83b41a..6cee704 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -438,7 +438,7 @@ IPC_BEGIN_MESSAGES(PluginHost)
gfx::PluginWindowHandle /* window */,
int32 /* width */,
int32 /* height */,
- uint64 /* identifier for IOSurface */)
+ uint64 /* surface_id */)
// On the Mac, shared memory can't be allocated in the sandbox, so
@@ -458,8 +458,9 @@ IPC_BEGIN_MESSAGES(PluginHost)
// browser process) that the plug-in swapped the buffers associated
// with the given "window", which should cause the browser to redraw
// the various plug-ins' contents.
- IPC_MESSAGE_ROUTED1(PluginHostMsg_AcceleratedSurfaceBuffersSwapped,
- gfx::PluginWindowHandle /* window */)
+ IPC_MESSAGE_ROUTED2(PluginHostMsg_AcceleratedSurfaceBuffersSwapped,
+ gfx::PluginWindowHandle /* window */,
+ uint64 /* surface_id */)
#endif
IPC_END_MESSAGES(PluginHost)
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 519e3da..a746a96 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -2238,14 +2238,15 @@ IPC_BEGIN_MESSAGES(ViewHost)
gfx::PluginWindowHandle /* window */,
int32 /* width */,
int32 /* height */,
- uint64 /* identifier for IOSurface */)
+ uint64 /* surface_id */)
// This message notifies the browser process that the plug-in
// swapped the buffers associated with the given "window", which
// should cause the browser to redraw the various plug-ins'
// contents.
- IPC_MESSAGE_ROUTED1(ViewHostMsg_AcceleratedSurfaceBuffersSwapped,
- gfx::PluginWindowHandle /* window */)
+ IPC_MESSAGE_ROUTED2(ViewHostMsg_AcceleratedSurfaceBuffersSwapped,
+ gfx::PluginWindowHandle /* window */,
+ uint64 /* surface_id */)
#endif
// A renderer sends this to the browser process when it wants to create a
diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc
index 053d79c..2834c00 100644
--- a/chrome/gpu/gpu_command_buffer_stub.cc
+++ b/chrome/gpu/gpu_command_buffer_stub.cc
@@ -198,10 +198,8 @@ void GpuCommandBufferStub::OnSetWindowSize(const gfx::Size& size) {
void GpuCommandBufferStub::SwapBuffersCallback() {
ChildThread* gpu_thread = ChildThread::current();
- gpu_thread->Send(
- new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(renderer_id_,
- render_view_id_,
- handle_));
+ gpu_thread->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(
+ renderer_id_, render_view_id_, handle_, processor_->GetSurfaceId()));
}
#endif // defined(OS_MACOSX)
diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc
index 0be798a..5818414 100644
--- a/chrome/plugin/command_buffer_stub.cc
+++ b/chrome/plugin/command_buffer_stub.cc
@@ -226,8 +226,8 @@ void CommandBufferStub::OnSetWindowSize(const gfx::Size& size) {
}
void CommandBufferStub::SwapBuffersCallback() {
- Send(new PluginHostMsg_AcceleratedSurfaceBuffersSwapped(plugin_host_route_id_,
- window_));
+ Send(new PluginHostMsg_AcceleratedSurfaceBuffersSwapped(
+ plugin_host_route_id_, window_, processor_->GetSurfaceId()));
}
void CommandBufferStub::AllocTransportDIB(const size_t size,
diff --git a/chrome/plugin/webplugin_accelerated_surface_proxy_mac.cc b/chrome/plugin/webplugin_accelerated_surface_proxy_mac.cc
index 76ff768..6e3540e 100644
--- a/chrome/plugin/webplugin_accelerated_surface_proxy_mac.cc
+++ b/chrome/plugin/webplugin_accelerated_surface_proxy_mac.cc
@@ -59,5 +59,6 @@ void WebPluginAcceleratedSurfaceProxy::StartDrawing() {
void WebPluginAcceleratedSurfaceProxy::EndDrawing() {
surface_->SwapBuffers();
- plugin_proxy_->AcceleratedFrameBuffersDidSwap(window_handle_);
+ plugin_proxy_->AcceleratedFrameBuffersDidSwap(
+ window_handle_, surface_->GetSurfaceId());
}
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index f41da3e..f099963 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -669,8 +669,9 @@ WebPluginAcceleratedSurface* WebPluginProxy::GetAcceleratedSurface() {
}
void WebPluginProxy::AcceleratedFrameBuffersDidSwap(
- gfx::PluginWindowHandle window) {
- Send(new PluginHostMsg_AcceleratedSurfaceBuffersSwapped(route_id_, window));
+ gfx::PluginWindowHandle window, uint64 surface_id) {
+ Send(new PluginHostMsg_AcceleratedSurfaceBuffersSwapped(
+ route_id_, window, surface_id));
}
void WebPluginProxy::SetAcceleratedSurface(
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index a33dae7..5a24e2bf 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -149,7 +149,8 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
// Tell the browser (via the renderer) to invalidate because the
// accelerated buffers have changed.
- virtual void AcceleratedFrameBuffersDidSwap(gfx::PluginWindowHandle window);
+ virtual void AcceleratedFrameBuffersDidSwap(
+ gfx::PluginWindowHandle window, uint64 surface_id);
// Tell the renderer and browser to associate the given plugin handle with
// |accelerated_surface_identifier|. The geometry is used to resize any
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 3554944..0996272 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -5987,8 +5987,9 @@ void RenderView::AcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id) {
}
void RenderView::AcceleratedSurfaceBuffersSwapped(
- gfx::PluginWindowHandle window) {
- Send(new ViewHostMsg_AcceleratedSurfaceBuffersSwapped(routing_id(), window));
+ gfx::PluginWindowHandle window, uint64 surface_id) {
+ Send(new ViewHostMsg_AcceleratedSurfaceBuffersSwapped(
+ routing_id(), window, surface_id));
}
#endif
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index fddfb13..a39aa63 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -332,7 +332,8 @@ class RenderView : public RenderWidget,
int32 width,
int32 height,
TransportDIB::Handle transport_dib);
- void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window);
+ void AcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
+ uint64 surface_id);
#endif
void RegisterPluginDelegate(WebPluginDelegateProxy* delegate);
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index a2553f2..d53909c 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -1527,9 +1527,9 @@ void WebPluginDelegateProxy::OnAcceleratedSurfaceFreeTransportDIB(
}
void WebPluginDelegateProxy::OnAcceleratedSurfaceBuffersSwapped(
- gfx::PluginWindowHandle window) {
+ gfx::PluginWindowHandle window, uint64 surface_id) {
if (render_view_)
- render_view_->AcceleratedSurfaceBuffersSwapped(window);
+ render_view_->AcceleratedSurfaceBuffersSwapped(window, surface_id);
}
#endif
diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h
index ab2eac1..64f1b30 100644
--- a/chrome/renderer/webplugin_delegate_proxy.h
+++ b/chrome/renderer/webplugin_delegate_proxy.h
@@ -176,7 +176,8 @@ class WebPluginDelegateProxy
void OnAcceleratedSurfaceAllocTransportDIB(size_t size,
TransportDIB::Handle* dib_handle);
void OnAcceleratedSurfaceFreeTransportDIB(TransportDIB::Id dib_id);
- void OnAcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window);
+ void OnAcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
+ uint64 surface_id);
#endif
// Draw a graphic indicating a crashed plugin.
diff --git a/gpu/command_buffer/service/gpu_processor.h b/gpu/command_buffer/service/gpu_processor.h
index 79d9e73..986ab03 100644
--- a/gpu/command_buffer/service/gpu_processor.h
+++ b/gpu/command_buffer/service/gpu_processor.h
@@ -83,6 +83,8 @@ class GPUProcessor : public CommandBufferEngine {
virtual void SetTransportDIBAllocAndFree(
Callback2<size_t, TransportDIB::Handle*>::Type* allocator,
Callback1<TransportDIB::Id>::Type* deallocator);
+ // Returns the id of the current IOSurface, or 0.
+ virtual uint64 GetSurfaceId();
#endif
// Sets a callback which is called when a SwapBuffers command is processed.
diff --git a/gpu/command_buffer/service/gpu_processor_mac.cc b/gpu/command_buffer/service/gpu_processor_mac.cc
index 17dee69..99721e9 100644
--- a/gpu/command_buffer/service/gpu_processor_mac.cc
+++ b/gpu/command_buffer/service/gpu_processor_mac.cc
@@ -93,6 +93,12 @@ void GPUProcessor::SetTransportDIBAllocAndFree(
surface_->SetTransportDIBAllocAndFree(allocator, deallocator);
}
+uint64 GPUProcessor::GetSurfaceId() {
+ if (!surface_.get())
+ return 0;
+ return surface_->GetSurfaceId();
+}
+
void GPUProcessor::WillSwapBuffers() {
DCHECK(decoder_.get());
DCHECK(decoder_->GetGLContext());