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 #include "content/renderer/gpu/renderer_compositor_frame_sink.h" | 5 #include "content/renderer/gpu/renderer_compositor_frame_sink.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Destroy the begin frame source on the same thread it was bound on. | 92 // Destroy the begin frame source on the same thread it was bound on. |
93 // The CompositorFrameSink itself is destroyed on the main thread. | 93 // The CompositorFrameSink itself is destroyed on the main thread. |
94 begin_frame_source_ = nullptr; | 94 begin_frame_source_ = nullptr; |
95 compositor_frame_sink_proxy_->ClearCompositorFrameSink(); | 95 compositor_frame_sink_proxy_->ClearCompositorFrameSink(); |
96 compositor_frame_sink_filter_->RemoveHandlerOnCompositorThread( | 96 compositor_frame_sink_filter_->RemoveHandlerOnCompositorThread( |
97 routing_id_, compositor_frame_sink_filter_handler_); | 97 routing_id_, compositor_frame_sink_filter_handler_); |
98 | 98 |
99 cc::CompositorFrameSink::DetachFromClient(); | 99 cc::CompositorFrameSink::DetachFromClient(); |
100 } | 100 } |
101 | 101 |
102 void RendererCompositorFrameSink::SwapBuffers(cc::CompositorFrame frame) { | 102 void RendererCompositorFrameSink::SubmitCompositorFrame( |
| 103 cc::CompositorFrame frame) { |
103 { | 104 { |
104 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> | 105 std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> |
105 send_message_scope = | 106 send_message_scope = |
106 frame_swap_message_queue_->AcquireSendMessageScope(); | 107 frame_swap_message_queue_->AcquireSendMessageScope(); |
107 std::vector<std::unique_ptr<IPC::Message>> messages; | 108 std::vector<std::unique_ptr<IPC::Message>> messages; |
108 std::vector<IPC::Message> messages_to_deliver_with_frame; | 109 std::vector<IPC::Message> messages_to_deliver_with_frame; |
109 frame_swap_message_queue_->DrainMessages(&messages); | 110 frame_swap_message_queue_->DrainMessages(&messages); |
110 FrameSwapMessageQueue::TransferMessages(&messages, | 111 FrameSwapMessageQueue::TransferMessages(&messages, |
111 &messages_to_deliver_with_frame); | 112 &messages_to_deliver_with_frame); |
112 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, | 113 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, |
(...skipping 15 matching lines...) Expand all Loading... |
128 void RendererCompositorFrameSink::OnReclaimCompositorResources( | 129 void RendererCompositorFrameSink::OnReclaimCompositorResources( |
129 uint32_t compositor_frame_sink_id, | 130 uint32_t compositor_frame_sink_id, |
130 bool is_swap_ack, | 131 bool is_swap_ack, |
131 const cc::ReturnedResourceArray& resources) { | 132 const cc::ReturnedResourceArray& resources) { |
132 // Ignore message if it's a stale one coming from a different output surface | 133 // Ignore message if it's a stale one coming from a different output surface |
133 // (e.g. after a lost context). | 134 // (e.g. after a lost context). |
134 if (compositor_frame_sink_id != compositor_frame_sink_id_) | 135 if (compositor_frame_sink_id != compositor_frame_sink_id_) |
135 return; | 136 return; |
136 client_->ReclaimResources(resources); | 137 client_->ReclaimResources(resources); |
137 if (is_swap_ack) | 138 if (is_swap_ack) |
138 client_->DidSwapBuffersComplete(); | 139 client_->DidReceiveCompositorFrameAck(); |
139 } | 140 } |
140 | 141 |
141 bool RendererCompositorFrameSink::Send(IPC::Message* message) { | 142 bool RendererCompositorFrameSink::Send(IPC::Message* message) { |
142 return message_sender_->Send(message); | 143 return message_sender_->Send(message); |
143 } | 144 } |
144 | 145 |
145 } // namespace content | 146 } // namespace content |
OLD | NEW |