Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6913)

Unified Diff: content/common/gpu/image_transport_surface.cc

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | content/common/gpu/image_transport_surface_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/image_transport_surface.cc
===================================================================
--- content/common/gpu/image_transport_surface.cc (revision 108480)
+++ content/common/gpu/image_transport_surface.cc (working copy)
@@ -13,6 +13,12 @@
#include "content/common/gpu/gpu_messages.h"
#include "gpu/command_buffer/service/gpu_scheduler.h"
+ImageTransportSurface::ImageTransportSurface() {
+}
+
+ImageTransportSurface::~ImageTransportSurface() {
+}
+
ImageTransportHelper::ImageTransportHelper(ImageTransportSurface* surface,
GpuChannelManager* manager,
int32 render_view_id,
@@ -55,6 +61,7 @@
OnBuffersSwappedACK)
IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_NewACK,
OnNewSurfaceACK)
+ IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -90,6 +97,13 @@
manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
}
+void ImageTransportHelper::SendResizeView(const gfx::Size& size) {
+ manager_->Send(new GpuHostMsg_ResizeView(renderer_id_,
+ render_view_id_,
+ route_id_,
+ size));
+}
+
void ImageTransportHelper::SetScheduled(bool is_scheduled) {
gpu::GpuScheduler* scheduler = Scheduler();
if (!scheduler)
@@ -98,6 +112,13 @@
scheduler->SetScheduled(is_scheduled);
}
+void ImageTransportHelper::DeferToFence(base::Closure task) {
+ gpu::GpuScheduler* scheduler = Scheduler();
+ DCHECK(scheduler);
+
+ scheduler->DeferToFence(task);
+}
+
void ImageTransportHelper::OnBuffersSwappedACK() {
surface_->OnBuffersSwappedACK();
}
@@ -108,10 +129,40 @@
surface_->OnNewSurfaceACK(surface_id, shm_handle);
}
+void ImageTransportHelper::OnResizeViewACK() {
+ surface_->OnResizeViewACK();
+}
+
void ImageTransportHelper::Resize(gfx::Size size) {
+ // On windows, the surface is recreated and, in case the newly allocated
+ // surface happens to have the same address, it should be invalidated on the
+ // decoder so that future calls to MakeCurrent do not early out on the
+ // assumption that neither the context or surface have actually changed.
+#if defined(OS_WIN)
+ Decoder()->ReleaseCurrent();
+#endif
+
surface_->OnResize(size);
+
+#if defined(OS_WIN)
+ Decoder()->MakeCurrent();
+ SetSwapInterval();
+#endif
}
+void ImageTransportHelper::SetSwapInterval() {
+ GpuChannel* channel = manager_->LookupChannel(renderer_id_);
+ if (!channel)
+ return;
+
+ GpuCommandBufferStub* stub =
+ channel->LookupCommandBuffer(command_buffer_id_);
+ if (!stub)
+ return;
+
+ stub->SetSwapInterval();
+}
+
bool ImageTransportHelper::MakeCurrent() {
gpu::gles2::GLES2Decoder* decoder = Decoder();
if (!decoder)
@@ -145,4 +196,47 @@
return stub->decoder();
}
+PassThroughImageTransportSurface::PassThroughImageTransportSurface(
+ GpuChannelManager* manager,
+ int32 render_view_id,
+ int32 renderer_id,
+ int32 command_buffer_id,
+ gfx::GLSurface* surface) : GLSurfaceAdapter(surface) {
+ helper_.reset(new ImageTransportHelper(this,
+ manager,
+ render_view_id,
+ renderer_id,
+ command_buffer_id,
+ gfx::kNullPluginWindow));
+}
+
+PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {
+}
+
+bool PassThroughImageTransportSurface::Initialize() {
+ // The surface is assumed to have already been initialized.
+ return helper_->Initialize();
+}
+
+void PassThroughImageTransportSurface::Destroy() {
+ helper_->Destroy();
+ GLSurfaceAdapter::Destroy();
+}
+
+void PassThroughImageTransportSurface::OnNewSurfaceACK(
+ uint64 surface_id, TransportDIB::Handle surface_handle) {
+}
+
+void PassThroughImageTransportSurface::OnBuffersSwappedACK() {
+}
+
+void PassThroughImageTransportSurface::OnResizeViewACK() {
+ helper_->SetScheduled(true);
+}
+
+void PassThroughImageTransportSurface::OnResize(gfx::Size size) {
+ helper_->SendResizeView(size);
+ helper_->SetScheduled(false);
+}
+
#endif // defined(ENABLE_GPU)
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | content/common/gpu/image_transport_surface_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698