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 "cc/surfaces/direct_compositor_frame_sink.h" | 5 #include "cc/surfaces/direct_compositor_frame_sink.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void DirectCompositorFrameSink::DetachFromClient() { | 77 void DirectCompositorFrameSink::DetachFromClient() { |
78 // Unregister the SurfaceFactoryClient here instead of the dtor so that only | 78 // Unregister the SurfaceFactoryClient here instead of the dtor so that only |
79 // one client is alive for this namespace at any given time. | 79 // one client is alive for this namespace at any given time. |
80 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); | 80 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); |
81 if (!delegated_local_frame_id_.is_null()) | 81 if (!delegated_local_frame_id_.is_null()) |
82 factory_.Destroy(delegated_local_frame_id_); | 82 factory_.Destroy(delegated_local_frame_id_); |
83 | 83 |
84 CompositorFrameSink::DetachFromClient(); | 84 CompositorFrameSink::DetachFromClient(); |
85 } | 85 } |
86 | 86 |
87 void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) { | 87 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { |
88 gfx::Size frame_size = | 88 gfx::Size frame_size = |
89 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); | 89 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); |
90 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { | 90 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { |
91 if (!delegated_local_frame_id_.is_null()) { | 91 if (!delegated_local_frame_id_.is_null()) { |
92 factory_.Destroy(delegated_local_frame_id_); | 92 factory_.Destroy(delegated_local_frame_id_); |
93 } | 93 } |
94 delegated_local_frame_id_ = surface_id_allocator_.GenerateId(); | 94 delegated_local_frame_id_ = surface_id_allocator_.GenerateId(); |
95 factory_.Create(delegated_local_frame_id_); | 95 factory_.Create(delegated_local_frame_id_); |
96 last_swap_frame_size_ = frame_size; | 96 last_swap_frame_size_ = frame_size; |
97 } | 97 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // This notification is not relevant to our client outside of tests. | 134 // This notification is not relevant to our client outside of tests. |
135 } | 135 } |
136 | 136 |
137 void DirectCompositorFrameSink::DisplayDidDrawAndSwap() { | 137 void DirectCompositorFrameSink::DisplayDidDrawAndSwap() { |
138 // This notification is not relevant to our client outside of tests. We | 138 // This notification is not relevant to our client outside of tests. We |
139 // unblock the client from DidDrawCallback() when the surface is going to | 139 // unblock the client from DidDrawCallback() when the surface is going to |
140 // be drawn. | 140 // be drawn. |
141 } | 141 } |
142 | 142 |
143 void DirectCompositorFrameSink::DidDrawCallback() { | 143 void DirectCompositorFrameSink::DidDrawCallback() { |
144 client_->DidSwapBuffersComplete(); | 144 client_->DidReceiveCompositorFrameAck(); |
145 } | 145 } |
146 | 146 |
147 } // namespace cc | 147 } // namespace cc |
OLD | NEW |