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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { | 93 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { |
94 bool handled = true; | 94 bool handled = true; |
95 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) | 95 IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) |
96 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BuffersSwappedACK, | 96 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BuffersSwappedACK, |
97 OnBuffersSwappedACK) | 97 OnBuffersSwappedACK) |
98 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_PostSubBufferACK, | 98 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_PostSubBufferACK, |
99 OnPostSubBufferACK) | 99 OnPostSubBufferACK) |
100 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_NewACK, | 100 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_NewACK, |
101 OnNewSurfaceACK) | 101 OnNewSurfaceACK) |
| 102 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ReleaseACK, |
| 103 OnReleaseSurfaceACK) |
102 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); | 104 IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK); |
103 IPC_MESSAGE_UNHANDLED(handled = false) | 105 IPC_MESSAGE_UNHANDLED(handled = false) |
104 IPC_END_MESSAGE_MAP() | 106 IPC_END_MESSAGE_MAP() |
105 return handled; | 107 return handled; |
106 } | 108 } |
107 | 109 |
108 void ImageTransportHelper::SendAcceleratedSurfaceRelease( | 110 void ImageTransportHelper::SendAcceleratedSurfaceRelease( |
109 GpuHostMsg_AcceleratedSurfaceRelease_Params params) { | 111 GpuHostMsg_AcceleratedSurfaceRelease_Params params) { |
110 params.surface_id = stub_->surface_id(); | 112 params.surface_id = stub_->surface_id(); |
111 params.route_id = route_id_; | 113 params.route_id = route_id_; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void ImageTransportHelper::OnPostSubBufferACK() { | 177 void ImageTransportHelper::OnPostSubBufferACK() { |
176 surface_->OnPostSubBufferACK(); | 178 surface_->OnPostSubBufferACK(); |
177 } | 179 } |
178 | 180 |
179 void ImageTransportHelper::OnNewSurfaceACK( | 181 void ImageTransportHelper::OnNewSurfaceACK( |
180 uint64 surface_handle, | 182 uint64 surface_handle, |
181 TransportDIB::Handle shm_handle) { | 183 TransportDIB::Handle shm_handle) { |
182 surface_->OnNewSurfaceACK(surface_handle, shm_handle); | 184 surface_->OnNewSurfaceACK(surface_handle, shm_handle); |
183 } | 185 } |
184 | 186 |
| 187 void ImageTransportHelper::OnReleaseSurfaceACK( |
| 188 uint64 surface_id, bool success) { |
| 189 surface_->OnReleaseSurfaceACK(surface_id, success); |
| 190 } |
| 191 |
185 void ImageTransportHelper::OnResizeViewACK() { | 192 void ImageTransportHelper::OnResizeViewACK() { |
186 surface_->OnResizeViewACK(); | 193 surface_->OnResizeViewACK(); |
187 } | 194 } |
188 | 195 |
189 void ImageTransportHelper::Resize(gfx::Size size) { | 196 void ImageTransportHelper::Resize(gfx::Size size) { |
190 // On windows, the surface is recreated and, in case the newly allocated | 197 // On windows, the surface is recreated and, in case the newly allocated |
191 // surface happens to have the same address, it should be invalidated on the | 198 // surface happens to have the same address, it should be invalidated on the |
192 // decoder so that future calls to MakeCurrent do not early out on the | 199 // decoder so that future calls to MakeCurrent do not early out on the |
193 // assumption that neither the context or surface have actually changed. | 200 // assumption that neither the context or surface have actually changed. |
194 #if defined(OS_WIN) | 201 #if defined(OS_WIN) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 264 |
258 void PassThroughImageTransportSurface::Destroy() { | 265 void PassThroughImageTransportSurface::Destroy() { |
259 helper_->Destroy(); | 266 helper_->Destroy(); |
260 GLSurfaceAdapter::Destroy(); | 267 GLSurfaceAdapter::Destroy(); |
261 } | 268 } |
262 | 269 |
263 void PassThroughImageTransportSurface::OnNewSurfaceACK( | 270 void PassThroughImageTransportSurface::OnNewSurfaceACK( |
264 uint64 surface_handle, TransportDIB::Handle shm_handle) { | 271 uint64 surface_handle, TransportDIB::Handle shm_handle) { |
265 } | 272 } |
266 | 273 |
| 274 void PassThroughImageTransportSurface::OnReleaseSurfaceACK( |
| 275 uint64 surface_id, bool success) { |
| 276 } |
| 277 |
267 bool PassThroughImageTransportSurface::SwapBuffers() { | 278 bool PassThroughImageTransportSurface::SwapBuffers() { |
268 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); | 279 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); |
269 | 280 |
270 if (transport_) { | 281 if (transport_) { |
271 // Round trip to the browser UI thread, for throttling, by sending a dummy | 282 // Round trip to the browser UI thread, for throttling, by sending a dummy |
272 // SwapBuffers message. | 283 // SwapBuffers message. |
273 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 284 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
274 params.surface_handle = 0; | 285 params.surface_handle = 0; |
275 #if defined(OS_WIN) | 286 #if defined(OS_WIN) |
276 params.size = GetSize(); | 287 params.size = GetSize(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 343 |
333 if (transport_) { | 344 if (transport_) { |
334 helper_->SendResizeView(size); | 345 helper_->SendResizeView(size); |
335 helper_->SetScheduled(false); | 346 helper_->SetScheduled(false); |
336 } else { | 347 } else { |
337 Resize(new_size_); | 348 Resize(new_size_); |
338 } | 349 } |
339 } | 350 } |
340 | 351 |
341 #endif // defined(ENABLE_GPU) | 352 #endif // defined(ENABLE_GPU) |
OLD | NEW |