OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/renderer/child_frame_compositing_helper.h" | 5 #include "content/renderer/child_frame_compositing_helper.h" |
6 | 6 |
7 #include "cc/layers/delegated_frame_provider.h" | 7 #include "cc/layers/delegated_frame_provider.h" |
8 #include "cc/layers/delegated_frame_resource_collection.h" | 8 #include "cc/layers/delegated_frame_resource_collection.h" |
9 #include "cc/layers/delegated_renderer_layer.h" | 9 #include "cc/layers/delegated_renderer_layer.h" |
10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // However, if a buffer is freed up from | 239 // However, if a buffer is freed up from |
240 // the compositor in cases like switching back to SW mode without a new | 240 // the compositor in cases like switching back to SW mode without a new |
241 // buffer arriving, no ACK is needed. | 241 // buffer arriving, no ACK is needed. |
242 if (!ack_pending_) { | 242 if (!ack_pending_) { |
243 last_mailbox_valid_ = false; | 243 last_mailbox_valid_ = false; |
244 return; | 244 return; |
245 } | 245 } |
246 ack_pending_ = false; | 246 ack_pending_ = false; |
247 switch (mailbox.type) { | 247 switch (mailbox.type) { |
248 case TEXTURE_IMAGE_TRANSPORT: { | 248 case TEXTURE_IMAGE_TRANSPORT: { |
249 std::string mailbox_name(reinterpret_cast<const char*>(mailbox.name.name), | |
250 sizeof(mailbox.name.name)); | |
251 FrameHostMsg_BuffersSwappedACK_Params params; | 249 FrameHostMsg_BuffersSwappedACK_Params params; |
252 params.gpu_host_id = mailbox.host_id; | 250 params.gpu_host_id = mailbox.host_id; |
253 params.gpu_route_id = mailbox.route_id; | 251 params.gpu_route_id = mailbox.route_id; |
254 params.mailbox_name = mailbox_name; | 252 params.mailbox = mailbox.name; |
255 params.sync_point = sync_point; | 253 params.sync_point = sync_point; |
256 SendBuffersSwappedACKToBrowser(params); | 254 SendBuffersSwappedACKToBrowser(params); |
257 break; | 255 break; |
258 } | 256 } |
259 case GL_COMPOSITOR_FRAME: { | 257 case GL_COMPOSITOR_FRAME: { |
260 FrameHostMsg_CompositorFrameSwappedACK_Params params; | 258 FrameHostMsg_CompositorFrameSwappedACK_Params params; |
261 params.producing_host_id = mailbox.host_id; | 259 params.producing_host_id = mailbox.host_id; |
262 params.producing_route_id = mailbox.route_id; | 260 params.producing_route_id = mailbox.route_id; |
263 params.output_surface_id = mailbox.output_surface_id; | 261 params.output_surface_id = mailbox.output_surface_id; |
264 params.ack.gl_frame_data.reset(new cc::GLFrameData()); | 262 params.ack.gl_frame_data.reset(new cc::GLFrameData()); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 369 } |
372 | 370 |
373 texture_layer_->SetFlipped(!is_software_frame); | 371 texture_layer_->SetFlipped(!is_software_frame); |
374 texture_layer_->SetTextureMailbox(texture_mailbox, release_callback.Pass()); | 372 texture_layer_->SetTextureMailbox(texture_mailbox, release_callback.Pass()); |
375 texture_layer_->SetNeedsDisplay(); | 373 texture_layer_->SetNeedsDisplay(); |
376 last_mailbox_valid_ = current_mailbox_valid; | 374 last_mailbox_valid_ = current_mailbox_valid; |
377 } | 375 } |
378 | 376 |
379 void ChildFrameCompositingHelper::OnBuffersSwapped( | 377 void ChildFrameCompositingHelper::OnBuffersSwapped( |
380 const gfx::Size& size, | 378 const gfx::Size& size, |
381 const std::string& mailbox_name, | 379 const gpu::Mailbox& mailbox, |
382 int gpu_route_id, | 380 int gpu_route_id, |
383 int gpu_host_id, | 381 int gpu_host_id, |
384 float device_scale_factor) { | 382 float device_scale_factor) { |
385 SwapBuffersInfo swap_info; | 383 SwapBuffersInfo swap_info; |
386 swap_info.name.SetName(reinterpret_cast<const int8*>(mailbox_name.data())); | 384 swap_info.name = mailbox; |
387 swap_info.type = TEXTURE_IMAGE_TRANSPORT; | 385 swap_info.type = TEXTURE_IMAGE_TRANSPORT; |
388 swap_info.size = size; | 386 swap_info.size = size; |
389 swap_info.route_id = gpu_route_id; | 387 swap_info.route_id = gpu_route_id; |
390 swap_info.output_surface_id = 0; | 388 swap_info.output_surface_id = 0; |
391 swap_info.host_id = gpu_host_id; | 389 swap_info.host_id = gpu_host_id; |
392 OnBuffersSwappedPrivate(swap_info, 0, device_scale_factor); | 390 OnBuffersSwappedPrivate(swap_info, 0, device_scale_factor); |
393 } | 391 } |
394 | 392 |
395 void ChildFrameCompositingHelper::OnCompositorFrameSwapped( | 393 void ChildFrameCompositingHelper::OnCompositorFrameSwapped( |
396 scoped_ptr<cc::CompositorFrame> frame, | 394 scoped_ptr<cc::CompositorFrame> frame, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 dest_size.height()); | 556 dest_size.height()); |
559 } | 557 } |
560 if (GetBrowserPluginManager()) { | 558 if (GetBrowserPluginManager()) { |
561 GetBrowserPluginManager()->Send( | 559 GetBrowserPluginManager()->Send( |
562 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck( | 560 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck( |
563 host_routing_id_, GetInstanceID(), request_id, resized_bitmap)); | 561 host_routing_id_, GetInstanceID(), request_id, resized_bitmap)); |
564 } | 562 } |
565 } | 563 } |
566 | 564 |
567 } // namespace content | 565 } // namespace content |
OLD | NEW |