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