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

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

Issue 11475017: Revert 171569 as it broke some browser_tests on win_aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "content/common/gpu/image_transport_surface.h" 7 #include "content/common/gpu/image_transport_surface.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "content/common/gpu/gpu_channel.h" 13 #include "content/common/gpu/gpu_channel.h"
14 #include "content/common/gpu/gpu_channel_manager.h" 14 #include "content/common/gpu/gpu_channel_manager.h"
15 #include "content/common/gpu/gpu_command_buffer_stub.h" 15 #include "content/common/gpu/gpu_command_buffer_stub.h"
16 #include "content/common/gpu/gpu_messages.h" 16 #include "content/common/gpu/gpu_messages.h"
17 #include "gpu/command_buffer/service/gpu_scheduler.h" 17 #include "gpu/command_buffer/service/gpu_scheduler.h"
18 #include "ui/gl/gl_switches.h" 18 #include "ui/gl/gl_switches.h"
19 #include "ui/gl/gl_implementation.h" 19 #include "ui/gl/gl_implementation.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 ImageTransportSurface::ImageTransportSurface() {} 23 ImageTransportSurface::ImageTransportSurface() {}
24 24
25 ImageTransportSurface::~ImageTransportSurface() {} 25 ImageTransportSurface::~ImageTransportSurface() {}
26 26
27 void ImageTransportSurface::OnSetFrontSurfaceIsProtected(
28 bool is_protected, uint32 protection_state_id) {
29 }
30
27 void ImageTransportSurface::GetRegionsToCopy( 31 void ImageTransportSurface::GetRegionsToCopy(
28 const gfx::Rect& previous_damage_rect, 32 const gfx::Rect& previous_damage_rect,
29 const gfx::Rect& new_damage_rect, 33 const gfx::Rect& new_damage_rect,
30 std::vector<gfx::Rect>* regions) { 34 std::vector<gfx::Rect>* regions) {
31 gfx::Rect intersection = 35 gfx::Rect intersection =
32 gfx::IntersectRects(previous_damage_rect, new_damage_rect); 36 gfx::IntersectRects(previous_damage_rect, new_damage_rect);
33 37
34 if (intersection.IsEmpty()) { 38 if (intersection.IsEmpty()) {
35 regions->push_back(previous_damage_rect); 39 regions->push_back(previous_damage_rect);
36 return; 40 return;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return true; 93 return true;
90 } 94 }
91 95
92 void ImageTransportHelper::Destroy() {} 96 void ImageTransportHelper::Destroy() {}
93 97
94 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { 98 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) {
95 bool handled = true; 99 bool handled = true;
96 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) 100 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message)
97 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, 101 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented,
98 OnBufferPresented) 102 OnBufferPresented)
103 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_SetFrontSurfaceIsProtected,
104 OnSetFrontSurfaceIsProtected)
99 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); 105 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK);
100 IPC_MESSAGE_UNHANDLED(handled = false) 106 IPC_MESSAGE_UNHANDLED(handled = false)
101 IPC_END_MESSAGE_MAP() 107 IPC_END_MESSAGE_MAP()
102 return handled; 108 return handled;
103 } 109 }
104 110
105 void ImageTransportHelper::SendAcceleratedSurfaceNew( 111 void ImageTransportHelper::SendAcceleratedSurfaceNew(
106 GpuHostMsg_AcceleratedSurfaceNew_Params params) { 112 GpuHostMsg_AcceleratedSurfaceNew_Params params) {
107 params.surface_id = stub_->surface_id(); 113 params.surface_id = stub_->surface_id();
108 params.route_id = route_id_; 114 params.route_id = route_id_;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return NULL; 205 return NULL;
200 return stub_->scheduler(); 206 return stub_->scheduler();
201 } 207 }
202 208
203 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { 209 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() {
204 if (!stub_.get()) 210 if (!stub_.get())
205 return NULL; 211 return NULL;
206 return stub_->decoder(); 212 return stub_->decoder();
207 } 213 }
208 214
209 void ImageTransportHelper::OnBufferPresented(uint64 surface_handle, 215 void ImageTransportHelper::OnSetFrontSurfaceIsProtected(
216 bool is_protected, uint32 protection_state_id) {
217 surface_->OnSetFrontSurfaceIsProtected(is_protected, protection_state_id);
218 }
219
220 void ImageTransportHelper::OnBufferPresented(bool presented,
210 uint32 sync_point) { 221 uint32 sync_point) {
211 surface_->OnBufferPresented(surface_handle, sync_point); 222 surface_->OnBufferPresented(presented, sync_point);
212 } 223 }
213 224
214 void ImageTransportHelper::OnResizeViewACK() { 225 void ImageTransportHelper::OnResizeViewACK() {
215 surface_->OnResizeViewACK(); 226 surface_->OnResizeViewACK();
216 } 227 }
217 228
218 void ImageTransportHelper::Resize(gfx::Size size) { 229 void ImageTransportHelper::Resize(gfx::Size size) {
219 // On windows, the surface is recreated and, in case the newly allocated 230 // On windows, the surface is recreated and, in case the newly allocated
220 // surface happens to have the same address, it should be invalidated on the 231 // surface happens to have the same address, it should be invalidated on the
221 // decoder so that future calls to MakeCurrent do not early out on the 232 // decoder so that future calls to MakeCurrent do not early out on the
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 315
305 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { 316 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) {
306 if (!did_set_swap_interval_) { 317 if (!did_set_swap_interval_) {
307 ImageTransportHelper::SetSwapInterval(context); 318 ImageTransportHelper::SetSwapInterval(context);
308 did_set_swap_interval_ = true; 319 did_set_swap_interval_ = true;
309 } 320 }
310 return true; 321 return true;
311 } 322 }
312 323
313 void PassThroughImageTransportSurface::OnBufferPresented( 324 void PassThroughImageTransportSurface::OnBufferPresented(
314 uint64 /* surface_handle */, 325 bool /* presented */,
315 uint32 /* sync_point */) { 326 uint32 /* sync_point */) {
316 DCHECK(transport_); 327 DCHECK(transport_);
317 helper_->SetScheduled(true); 328 helper_->SetScheduled(true);
318 } 329 }
319 330
320 void PassThroughImageTransportSurface::OnResizeViewACK() { 331 void PassThroughImageTransportSurface::OnResizeViewACK() {
321 DCHECK(transport_); 332 DCHECK(transport_);
322 Resize(new_size_); 333 Resize(new_size_);
323 334
324 helper_->SetScheduled(true); 335 helper_->SetScheduled(true);
(...skipping 18 matching lines...) Expand all
343 354
344 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 355 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
345 GetVSyncParameters( 356 GetVSyncParameters(
346 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, 357 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters,
347 helper_->AsWeakPtr())); 358 helper_->AsWeakPtr()));
348 } 359 }
349 360
350 } // namespace content 361 } // namespace content
351 362
352 #endif // defined(ENABLE_GPU) 363 #endif // defined(ENABLE_GPU)
OLDNEW
« 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