| OLD | NEW |
| 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 | |
| 31 void ImageTransportSurface::GetRegionsToCopy( | 27 void ImageTransportSurface::GetRegionsToCopy( |
| 32 const gfx::Rect& previous_damage_rect, | 28 const gfx::Rect& previous_damage_rect, |
| 33 const gfx::Rect& new_damage_rect, | 29 const gfx::Rect& new_damage_rect, |
| 34 std::vector<gfx::Rect>* regions) { | 30 std::vector<gfx::Rect>* regions) { |
| 35 gfx::Rect intersection = previous_damage_rect; | 31 gfx::Rect intersection = previous_damage_rect; |
| 36 intersection.Intersect(new_damage_rect); | 32 intersection.Intersect(new_damage_rect); |
| 37 | 33 |
| 38 if (intersection.IsEmpty()) { | 34 if (intersection.IsEmpty()) { |
| 39 regions->push_back(previous_damage_rect); | 35 regions->push_back(previous_damage_rect); |
| 40 return; | 36 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return true; | 89 return true; |
| 94 } | 90 } |
| 95 | 91 |
| 96 void ImageTransportHelper::Destroy() {} | 92 void ImageTransportHelper::Destroy() {} |
| 97 | 93 |
| 98 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { | 94 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { |
| 99 bool handled = true; | 95 bool handled = true; |
| 100 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) | 96 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) |
| 101 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, | 97 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, |
| 102 OnBufferPresented) | 98 OnBufferPresented) |
| 103 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_SetFrontSurfaceIsProtected, | |
| 104 OnSetFrontSurfaceIsProtected) | |
| 105 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); | 99 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); |
| 106 IPC_MESSAGE_UNHANDLED(handled = false) | 100 IPC_MESSAGE_UNHANDLED(handled = false) |
| 107 IPC_END_MESSAGE_MAP() | 101 IPC_END_MESSAGE_MAP() |
| 108 return handled; | 102 return handled; |
| 109 } | 103 } |
| 110 | 104 |
| 111 void ImageTransportHelper::SendAcceleratedSurfaceNew( | 105 void ImageTransportHelper::SendAcceleratedSurfaceNew( |
| 112 GpuHostMsg_AcceleratedSurfaceNew_Params params) { | 106 GpuHostMsg_AcceleratedSurfaceNew_Params params) { |
| 113 params.surface_id = stub_->surface_id(); | 107 params.surface_id = stub_->surface_id(); |
| 114 params.route_id = route_id_; | 108 params.route_id = route_id_; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return NULL; | 194 return NULL; |
| 201 return stub_->scheduler(); | 195 return stub_->scheduler(); |
| 202 } | 196 } |
| 203 | 197 |
| 204 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { | 198 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { |
| 205 if (!stub_.get()) | 199 if (!stub_.get()) |
| 206 return NULL; | 200 return NULL; |
| 207 return stub_->decoder(); | 201 return stub_->decoder(); |
| 208 } | 202 } |
| 209 | 203 |
| 210 void ImageTransportHelper::OnSetFrontSurfaceIsProtected( | |
| 211 bool is_protected, uint32 protection_state_id) { | |
| 212 surface_->OnSetFrontSurfaceIsProtected(is_protected, protection_state_id); | |
| 213 } | |
| 214 | |
| 215 void ImageTransportHelper::OnBufferPresented(uint32 sync_point) { | 204 void ImageTransportHelper::OnBufferPresented(uint32 sync_point) { |
| 216 surface_->OnBufferPresented(sync_point); | 205 surface_->OnBufferPresented(sync_point); |
| 217 } | 206 } |
| 218 | 207 |
| 219 void ImageTransportHelper::OnResizeViewACK() { | 208 void ImageTransportHelper::OnResizeViewACK() { |
| 220 surface_->OnResizeViewACK(); | 209 surface_->OnResizeViewACK(); |
| 221 } | 210 } |
| 222 | 211 |
| 223 void ImageTransportHelper::Resize(gfx::Size size) { | 212 void ImageTransportHelper::Resize(gfx::Size size) { |
| 224 // On windows, the surface is recreated and, in case the newly allocated | 213 // On windows, the surface is recreated and, in case the newly allocated |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 325 |
| 337 gfx::Size PassThroughImageTransportSurface::GetSize() { | 326 gfx::Size PassThroughImageTransportSurface::GetSize() { |
| 338 return GLSurfaceAdapter::GetSize(); | 327 return GLSurfaceAdapter::GetSize(); |
| 339 } | 328 } |
| 340 | 329 |
| 341 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} | 330 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} |
| 342 | 331 |
| 343 } // namespace content | 332 } // namespace content |
| 344 | 333 |
| 345 #endif // defined(ENABLE_GPU) | 334 #endif // defined(ENABLE_GPU) |
| OLD | NEW |