| 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/browser/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 frame_connector_->SetChildFrameSurface(surface_id_, frame_size, | 415 frame_connector_->SetChildFrameSurface(surface_id_, frame_size, |
| 416 scale_factor, sequence); | 416 scale_factor, sequence); |
| 417 } | 417 } |
| 418 | 418 |
| 419 cc::SurfaceFactory::DrawCallback ack_callback = | 419 cc::SurfaceFactory::DrawCallback ack_callback = |
| 420 base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(), | 420 base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(), |
| 421 output_surface_id); | 421 output_surface_id); |
| 422 ack_pending_count_++; | 422 ack_pending_count_++; |
| 423 // If this value grows very large, something is going wrong. | 423 // If this value grows very large, something is going wrong. |
| 424 DCHECK_LT(ack_pending_count_, 1000U); | 424 DCHECK_LT(ack_pending_count_, 1000U); |
| 425 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), | 425 std::unique_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame); |
| 426 *frame_copy = std::move(frame); |
| 427 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame_copy), |
| 426 ack_callback); | 428 ack_callback); |
| 427 | 429 |
| 428 ProcessFrameSwappedCallbacks(); | 430 ProcessFrameSwappedCallbacks(); |
| 429 } | 431 } |
| 430 | 432 |
| 431 void RenderWidgetHostViewChildFrame::ProcessFrameSwappedCallbacks() { | 433 void RenderWidgetHostViewChildFrame::ProcessFrameSwappedCallbacks() { |
| 432 // We only use callbacks once, therefore we make a new list for registration | 434 // We only use callbacks once, therefore we make a new list for registration |
| 433 // before we start, and discard the old list entries when we are done. | 435 // before we start, and discard the old list entries when we are done. |
| 434 FrameSwappedCallbackList process_callbacks; | 436 FrameSwappedCallbackList process_callbacks; |
| 435 process_callbacks.swap(frame_swapped_callbacks_); | 437 process_callbacks.swap(frame_swapped_callbacks_); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 694 |
| 693 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 695 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 694 return true; | 696 return true; |
| 695 } | 697 } |
| 696 | 698 |
| 697 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 699 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 698 return surface_id_; | 700 return surface_id_; |
| 699 }; | 701 }; |
| 700 | 702 |
| 701 } // namespace content | 703 } // namespace content |
| OLD | NEW |