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

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

Issue 83173010: Revert 236150 "Disable Vsync when Aero Glass is enabled." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/debug/trace_event.h" 10 #include "base/debug/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/common/gpu/sync_point_manager.h" 15 #include "content/common/gpu/sync_point_manager.h"
16 #include "content/common/gpu/texture_image_transport_surface.h" 16 #include "content/common/gpu/texture_image_transport_surface.h"
17 #include "gpu/command_buffer/service/gpu_scheduler.h" 17 #include "gpu/command_buffer/service/gpu_scheduler.h"
18 #include "ui/gfx/vsync_provider.h" 18 #include "ui/gfx/vsync_provider.h"
19 #include "ui/gl/gl_implementation.h" 19 #include "ui/gl/gl_implementation.h"
20 #include "ui/gl/gl_switches.h" 20 #include "ui/gl/gl_switches.h"
21 21
22 #if defined(OS_WIN)
23 #include "ui/base/win/shell.h"
24 #endif
25
26 namespace content { 22 namespace content {
27 23
28 ImageTransportSurface::ImageTransportSurface() {} 24 ImageTransportSurface::ImageTransportSurface() {}
29 25
30 ImageTransportSurface::~ImageTransportSurface() {} 26 ImageTransportSurface::~ImageTransportSurface() {}
31 27
32 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( 28 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface(
33 GpuChannelManager* manager, 29 GpuChannelManager* manager,
34 GpuCommandBufferStub* stub, 30 GpuCommandBufferStub* stub,
35 const gfx::GLSurfaceHandle& handle) { 31 const gfx::GLSurfaceHandle& handle) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 157 }
162 158
163 bool ImageTransportHelper::MakeCurrent() { 159 bool ImageTransportHelper::MakeCurrent() {
164 gpu::gles2::GLES2Decoder* decoder = Decoder(); 160 gpu::gles2::GLES2Decoder* decoder = Decoder();
165 if (!decoder) 161 if (!decoder)
166 return false; 162 return false;
167 return decoder->MakeCurrent(); 163 return decoder->MakeCurrent();
168 } 164 }
169 165
170 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) { 166 void ImageTransportHelper::SetSwapInterval(gfx::GLContext* context) {
171 #if defined(OS_WIN)
172 // If Aero Glass is enabled, then the renderer will handle ratelimiting and
173 // there's no tearing, so waiting for vsync is unnecessary.
174 if (ui::win::IsAeroGlassEnabled()) {
175 context->SetSwapInterval(0);
176 return;
177 }
178 #endif
179 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync)) 167 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableGpuVsync))
180 context->SetSwapInterval(0); 168 context->SetSwapInterval(0);
181 else 169 else
182 context->SetSwapInterval(1); 170 context->SetSwapInterval(1);
183 } 171 }
184 172
185 void ImageTransportHelper::Suspend() { 173 void ImageTransportHelper::Suspend() {
186 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id())); 174 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id()));
187 } 175 }
188 176
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 363 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
376 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 364 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
377 if (vsync_provider) { 365 if (vsync_provider) {
378 vsync_provider->GetVSyncParameters( 366 vsync_provider->GetVSyncParameters(
379 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 367 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
380 helper_->AsWeakPtr())); 368 helper_->AsWeakPtr()));
381 } 369 }
382 } 370 }
383 371
384 } // namespace content 372 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698