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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::Bind(&ImageTransportHelper::Resize, base::Unretained(this))); | 83 base::Bind(&ImageTransportHelper::Resize, base::Unretained(this))); |
84 | 84 |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 void ImageTransportHelper::Destroy() {} | 88 void ImageTransportHelper::Destroy() {} |
89 | 89 |
90 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { | 90 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { |
91 bool handled = true; | 91 bool handled = true; |
92 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) | 92 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) |
93 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BuffersSwappedACK, | 93 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, |
94 OnBuffersSwappedACK) | 94 OnBufferPresented) |
95 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_PostSubBufferACK, | |
96 OnPostSubBufferACK) | |
97 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_NewACK, | 95 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_NewACK, |
98 OnNewSurfaceACK) | 96 OnNewSurfaceACK) |
99 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); | 97 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); |
100 IPC_MESSAGE_UNHANDLED(handled = false) | 98 IPC_MESSAGE_UNHANDLED(handled = false) |
101 IPC_END_MESSAGE_MAP() | 99 IPC_END_MESSAGE_MAP() |
102 return handled; | 100 return handled; |
103 } | 101 } |
104 | 102 |
105 void ImageTransportHelper::SendAcceleratedSurfaceNew( | 103 void ImageTransportHelper::SendAcceleratedSurfaceNew( |
106 GpuHostMsg_AcceleratedSurfaceNew_Params params) { | 104 GpuHostMsg_AcceleratedSurfaceNew_Params params) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 return NULL; | 192 return NULL; |
195 return stub_->decoder(); | 193 return stub_->decoder(); |
196 } | 194 } |
197 | 195 |
198 void ImageTransportHelper::OnNewSurfaceACK( | 196 void ImageTransportHelper::OnNewSurfaceACK( |
199 uint64 surface_handle, | 197 uint64 surface_handle, |
200 TransportDIB::Handle shm_handle) { | 198 TransportDIB::Handle shm_handle) { |
201 surface_->OnNewSurfaceACK(surface_handle, shm_handle); | 199 surface_->OnNewSurfaceACK(surface_handle, shm_handle); |
202 } | 200 } |
203 | 201 |
204 void ImageTransportHelper::OnBuffersSwappedACK() { | 202 void ImageTransportHelper::OnBufferPresented() { |
205 surface_->OnBuffersSwappedACK(); | 203 surface_->OnBufferPresented(); |
206 } | |
207 | |
208 void ImageTransportHelper::OnPostSubBufferACK() { | |
209 surface_->OnPostSubBufferACK(); | |
210 } | 204 } |
211 | 205 |
212 void ImageTransportHelper::OnResizeViewACK() { | 206 void ImageTransportHelper::OnResizeViewACK() { |
213 surface_->OnResizeViewACK(); | 207 surface_->OnResizeViewACK(); |
214 } | 208 } |
215 | 209 |
216 void ImageTransportHelper::Resize(gfx::Size size) { | 210 void ImageTransportHelper::Resize(gfx::Size size) { |
217 // On windows, the surface is recreated and, in case the newly allocated | 211 // On windows, the surface is recreated and, in case the newly allocated |
218 // surface happens to have the same address, it should be invalidated on the | 212 // surface happens to have the same address, it should be invalidated on the |
219 // decoder so that future calls to MakeCurrent do not early out on the | 213 // 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 Loading... |
302 did_set_swap_interval_ = true; | 296 did_set_swap_interval_ = true; |
303 } | 297 } |
304 return true; | 298 return true; |
305 } | 299 } |
306 | 300 |
307 void PassThroughImageTransportSurface::OnNewSurfaceACK( | 301 void PassThroughImageTransportSurface::OnNewSurfaceACK( |
308 uint64 surface_handle, | 302 uint64 surface_handle, |
309 TransportDIB::Handle shm_handle) { | 303 TransportDIB::Handle shm_handle) { |
310 } | 304 } |
311 | 305 |
312 void PassThroughImageTransportSurface::OnBuffersSwappedACK() { | 306 void PassThroughImageTransportSurface::OnBufferPresented() { |
313 DCHECK(transport_); | 307 DCHECK(transport_); |
314 helper_->SetScheduled(true); | 308 helper_->SetScheduled(true); |
315 } | 309 } |
316 | |
317 void PassThroughImageTransportSurface::OnPostSubBufferACK() { | |
318 DCHECK(transport_); | |
319 helper_->SetScheduled(true); | |
320 } | |
321 | 310 |
322 void PassThroughImageTransportSurface::OnResizeViewACK() { | 311 void PassThroughImageTransportSurface::OnResizeViewACK() { |
323 DCHECK(transport_); | 312 DCHECK(transport_); |
324 Resize(new_size_); | 313 Resize(new_size_); |
325 | 314 |
326 helper_->SetScheduled(true); | 315 helper_->SetScheduled(true); |
327 } | 316 } |
328 | 317 |
329 void PassThroughImageTransportSurface::OnResize(gfx::Size size) { | 318 void PassThroughImageTransportSurface::OnResize(gfx::Size size) { |
330 new_size_ = size; | 319 new_size_ = size; |
331 | 320 |
332 if (transport_) { | 321 if (transport_) { |
333 helper_->SendResizeView(size); | 322 helper_->SendResizeView(size); |
334 helper_->SetScheduled(false); | 323 helper_->SetScheduled(false); |
335 } else { | 324 } else { |
336 Resize(new_size_); | 325 Resize(new_size_); |
337 } | 326 } |
338 } | 327 } |
339 | 328 |
340 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} | 329 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} |
341 | 330 |
342 #endif // defined(ENABLE_GPU) | 331 #endif // defined(ENABLE_GPU) |
OLD | NEW |