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

Side by Side Diff: content/common/gpu/null_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 unified diff | Download patch
« no previous file with comments | « content/common/gpu/null_transport_surface.h ('k') | content/content_common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/common/gpu/null_transport_surface.h"
6
7 #include "base/command_line.h"
8 #include "content/common/gpu/gpu_channel.h"
9 #include "content/common/gpu/gpu_channel_manager.h"
10 #include "content/common/gpu/gpu_command_buffer_stub.h"
11 #include "content/public/common/content_switches.h"
12 #include "gpu/command_buffer/service/context_group.h"
13
14 namespace content {
15
16 NullTransportSurface::NullTransportSurface(
17 GpuChannelManager* manager,
18 GpuCommandBufferStub* stub,
19 const gfx::GLSurfaceHandle& handle)
20 : PassThroughImageTransportSurface(manager,
21 stub,
22 manager->GetDefaultOffscreenSurface()),
23 parent_client_id_(handle.parent_client_id) {
24 }
25
26 NullTransportSurface::~NullTransportSurface() {
27 }
28
29 bool NullTransportSurface::Initialize() {
30 if (!surface())
31 return false;
32
33 if (!PassThroughImageTransportSurface::Initialize())
34 return false;
35
36 GpuChannel* parent_channel =
37 GetHelper()->manager()->LookupChannel(parent_client_id_);
38 if (parent_channel) {
39 const base::CommandLine* command_line =
40 base::CommandLine::ForCurrentProcess();
41 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess))
42 GetHelper()->SetPreemptByFlag(parent_channel->GetPreemptionFlag());
43 }
44
45 return true;
46 }
47
48 void NullTransportSurface::Destroy() {
49 // Do not destroy |surface_| since we use the shared offscreen surface.
50 }
51
52 gfx::SwapResult NullTransportSurface::SwapBuffers() {
53 NOTIMPLEMENTED();
54 return gfx::SwapResult::SWAP_FAILED;
55 }
56
57 gfx::SwapResult NullTransportSurface::PostSubBuffer(int x,
58 int y,
59 int width,
60 int height) {
61 NOTIMPLEMENTED();
62 return gfx::SwapResult::SWAP_FAILED;
63 }
64
65 void NullTransportSurface::SendVSyncUpdateIfAvailable() {
66 NOTREACHED();
67 }
68
69 bool NullTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
70 // Override PassThroughImageTransportSurface default behavior which
71 // sets the swap interval.
72 return true;
73 }
74
75 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/null_transport_surface.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698