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" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 void ImageTransportHelper::Destroy() {} | 89 void ImageTransportHelper::Destroy() {} |
90 | 90 |
91 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { | 91 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { |
92 bool handled = true; | 92 bool handled = true; |
93 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) | 93 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) |
94 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, | 94 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, |
95 OnBufferPresented) | 95 OnBufferPresented) |
96 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_NewACK, | |
97 OnNewSurfaceACK) | |
98 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); | 96 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); |
99 IPC_MESSAGE_UNHANDLED(handled = false) | 97 IPC_MESSAGE_UNHANDLED(handled = false) |
100 IPC_END_MESSAGE_MAP() | 98 IPC_END_MESSAGE_MAP() |
101 return handled; | 99 return handled; |
102 } | 100 } |
103 | 101 |
104 void ImageTransportHelper::SendAcceleratedSurfaceNew( | 102 void ImageTransportHelper::SendAcceleratedSurfaceNew( |
105 GpuHostMsg_AcceleratedSurfaceNew_Params params) { | 103 GpuHostMsg_AcceleratedSurfaceNew_Params params) { |
106 params.surface_id = stub_->surface_id(); | 104 params.surface_id = stub_->surface_id(); |
107 params.route_id = route_id_; | 105 params.route_id = route_id_; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return NULL; | 189 return NULL; |
192 return stub_->scheduler(); | 190 return stub_->scheduler(); |
193 } | 191 } |
194 | 192 |
195 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { | 193 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { |
196 if (!stub_.get()) | 194 if (!stub_.get()) |
197 return NULL; | 195 return NULL; |
198 return stub_->decoder(); | 196 return stub_->decoder(); |
199 } | 197 } |
200 | 198 |
201 void ImageTransportHelper::OnNewSurfaceACK( | |
202 uint64 surface_handle, | |
203 TransportDIB::Handle shm_handle) { | |
204 surface_->OnNewSurfaceACK(surface_handle, shm_handle); | |
205 } | |
206 | |
207 void ImageTransportHelper::OnBufferPresented(uint32 sync_point) { | 199 void ImageTransportHelper::OnBufferPresented(uint32 sync_point) { |
208 surface_->OnBufferPresented(sync_point); | 200 surface_->OnBufferPresented(sync_point); |
209 } | 201 } |
210 | 202 |
211 void ImageTransportHelper::OnResizeViewACK() { | 203 void ImageTransportHelper::OnResizeViewACK() { |
212 surface_->OnResizeViewACK(); | 204 surface_->OnResizeViewACK(); |
213 } | 205 } |
214 | 206 |
215 void ImageTransportHelper::Resize(gfx::Size size) { | 207 void ImageTransportHelper::Resize(gfx::Size size) { |
216 // On windows, the surface is recreated and, in case the newly allocated | 208 // On windows, the surface is recreated and, in case the newly allocated |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 288 } |
297 | 289 |
298 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { | 290 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |
299 if (!did_set_swap_interval_) { | 291 if (!did_set_swap_interval_) { |
300 ImageTransportHelper::SetSwapInterval(context); | 292 ImageTransportHelper::SetSwapInterval(context); |
301 did_set_swap_interval_ = true; | 293 did_set_swap_interval_ = true; |
302 } | 294 } |
303 return true; | 295 return true; |
304 } | 296 } |
305 | 297 |
306 void PassThroughImageTransportSurface::OnNewSurfaceACK( | |
307 uint64 surface_handle, | |
308 TransportDIB::Handle shm_handle) { | |
309 } | |
310 | |
311 void PassThroughImageTransportSurface::OnBufferPresented(uint32 sync_point) { | 298 void PassThroughImageTransportSurface::OnBufferPresented(uint32 sync_point) { |
312 DCHECK(transport_); | 299 DCHECK(transport_); |
313 helper_->SetScheduled(true); | 300 helper_->SetScheduled(true); |
314 } | 301 } |
315 | 302 |
316 void PassThroughImageTransportSurface::OnResizeViewACK() { | 303 void PassThroughImageTransportSurface::OnResizeViewACK() { |
317 DCHECK(transport_); | 304 DCHECK(transport_); |
318 Resize(new_size_); | 305 Resize(new_size_); |
319 | 306 |
320 helper_->SetScheduled(true); | 307 helper_->SetScheduled(true); |
(...skipping 10 matching lines...) Expand all Loading... |
331 } | 318 } |
332 } | 319 } |
333 | 320 |
334 gfx::Size PassThroughImageTransportSurface::GetSize() { | 321 gfx::Size PassThroughImageTransportSurface::GetSize() { |
335 return GLSurfaceAdapter::GetSize(); | 322 return GLSurfaceAdapter::GetSize(); |
336 } | 323 } |
337 | 324 |
338 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} | 325 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} |
339 | 326 |
340 #endif // defined(ENABLE_GPU) | 327 #endif // defined(ENABLE_GPU) |
OLD | NEW |