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

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

Issue 1366473002: Move WakeUpGpu logic to GpuChannelManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 5 years, 3 months 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_android.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
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index f1908a75cbd216148055298c004045e6d896567e..efcd04fec5efe9a7b0fa79f3b9a422a9933eeff6 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -12,7 +12,7 @@
#include "content/common/gpu/gpu_channel_manager.h"
#include "content/common/gpu/gpu_command_buffer_stub.h"
#include "content/common/gpu/gpu_messages.h"
-#include "content/common/gpu/null_transport_surface.h"
+#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "ui/gfx/vsync_provider.h"
#include "ui/gl/gl_context.h"
@@ -31,17 +31,22 @@ scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
const gfx::GLSurfaceHandle& handle) {
scoped_refptr<gfx::GLSurface> surface;
if (handle.transport_type == gfx::NULL_TRANSPORT) {
-#if defined(OS_ANDROID)
- surface = CreateTransportSurface(manager, stub, handle);
-#else
- surface = new NullTransportSurface(manager, stub, handle);
-#endif
+ GpuChannel* parent_channel = manager->LookupChannel(
+ handle.parent_client_id);
+ if (parent_channel) {
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess))
+ stub->channel()->SetPreemptByFlag(parent_channel->GetPreemptionFlag());
+ }
+
+ surface = manager->GetDefaultOffscreenSurface();
} else {
surface = CreateNativeSurface(manager, stub, handle);
+ if (!surface.get() || !surface->Initialize())
+ return NULL;
}
- if (!surface.get() || !surface->Initialize())
- return NULL;
return surface;
}
@@ -78,23 +83,22 @@ bool ImageTransportHelper::Initialize() {
base::Bind(&ImageTransportHelper::SetLatencyInfo,
base::Unretained(this)));
- manager_->Send(new GpuHostMsg_AcceleratedSurfaceInitialized(
- stub_->surface_id(), route_id_));
-
return true;
}
bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) {
+#if defined(OS_MACOSX)
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message)
-#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented,
OnBufferPresented)
-#endif
- IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_WakeUpGpu, OnWakeUpGpu);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
+#else
+ NOTREACHED();
+ return false;
+#endif
}
#if defined(OS_MACOSX)
@@ -144,10 +148,6 @@ void ImageTransportHelper::OnBufferPresented(
}
#endif
-void ImageTransportHelper::OnWakeUpGpu() {
- surface_->WakeUpGpu();
-}
-
void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) {
surface_->OnResize(size, scale_factor);
@@ -280,10 +280,6 @@ gfx::Size PassThroughImageTransportSurface::GetSize() {
return GLSurfaceAdapter::GetSize();
}
-void PassThroughImageTransportSurface::WakeUpGpu() {
- NOTREACHED();
-}
-
PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {}
void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | content/common/gpu/image_transport_surface_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698