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

Side by Side Diff: content/common/gpu/image_transport_surface.cc

Issue 1365563002: Make channel preemption not require view contexts for hookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wakeup_gpu
Patch Set: . 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/image_transport_surface.h" 5 #include "content/common/gpu/image_transport_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "content/common/gpu/gpu_channel.h" 11 #include "content/common/gpu/gpu_channel.h"
12 #include "content/common/gpu/gpu_channel_manager.h" 12 #include "content/common/gpu/gpu_channel_manager.h"
13 #include "content/common/gpu/gpu_command_buffer_stub.h" 13 #include "content/common/gpu/gpu_command_buffer_stub.h"
14 #include "content/common/gpu/gpu_messages.h" 14 #include "content/common/gpu/gpu_messages.h"
15 #include "content/public/common/content_switches.h"
16 #include "gpu/command_buffer/service/sync_point_manager.h" 15 #include "gpu/command_buffer/service/sync_point_manager.h"
17 #include "ui/gfx/vsync_provider.h" 16 #include "ui/gfx/vsync_provider.h"
18 #include "ui/gl/gl_context.h" 17 #include "ui/gl/gl_context.h"
19 #include "ui/gl/gl_implementation.h" 18 #include "ui/gl/gl_implementation.h"
20 #include "ui/gl/gl_switches.h" 19 #include "ui/gl/gl_switches.h"
21 20
22 namespace content { 21 namespace content {
23 22
24 ImageTransportSurface::ImageTransportSurface() {} 23 ImageTransportSurface::ImageTransportSurface() {}
25 24
26 ImageTransportSurface::~ImageTransportSurface() {} 25 ImageTransportSurface::~ImageTransportSurface() {}
27 26
28 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 27 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
29 GpuChannelManager* manager, 28 GpuChannelManager* manager,
30 GpuCommandBufferStub* stub, 29 GpuCommandBufferStub* stub,
31 const gfx::GLSurfaceHandle& handle) { 30 const gfx::GLSurfaceHandle& handle) {
32 scoped_refptr<gfx::GLSurface> surface; 31 scoped_refptr<gfx::GLSurface> surface;
33 if (handle.transport_type == gfx::NULL_TRANSPORT) { 32 if (handle.transport_type == gfx::NULL_TRANSPORT) {
34 GpuChannel* parent_channel = manager->LookupChannel(
35 handle.parent_client_id);
36 if (parent_channel) {
37 const base::CommandLine* command_line =
38 base::CommandLine::ForCurrentProcess();
39 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess))
40 stub->channel()->SetPreemptByFlag(parent_channel->GetPreemptionFlag());
41 }
42
43 surface = manager->GetDefaultOffscreenSurface(); 33 surface = manager->GetDefaultOffscreenSurface();
44 } else { 34 } else {
45 surface = CreateNativeSurface(manager, stub, handle); 35 surface = CreateNativeSurface(manager, stub, handle);
46 if (!surface.get() || !surface->Initialize()) 36 if (!surface.get() || !surface->Initialize())
47 return NULL; 37 return NULL;
48 } 38 }
49 39
50 return surface; 40 return surface;
51 } 41 }
52 42
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 274 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
285 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 275 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
286 if (vsync_provider) { 276 if (vsync_provider) {
287 vsync_provider->GetVSyncParameters( 277 vsync_provider->GetVSyncParameters(
288 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters, 278 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters,
289 helper_->stub()->AsWeakPtr())); 279 helper_->stub()->AsWeakPtr()));
290 } 280 }
291 } 281 }
292 282
293 } // namespace content 283 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698