| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::SubmitCompositorFrame(CompositorFrame frame) { | 87 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { |
| 88 gfx::Size frame_size = | 88 gfx::Size frame_size = frame.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_) { | 89 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { |
| 91 if (!delegated_local_frame_id_.is_null()) { | 90 if (!delegated_local_frame_id_.is_null()) { |
| 92 factory_.Destroy(delegated_local_frame_id_); | 91 factory_.Destroy(delegated_local_frame_id_); |
| 93 } | 92 } |
| 94 delegated_local_frame_id_ = surface_id_allocator_.GenerateId(); | 93 delegated_local_frame_id_ = surface_id_allocator_.GenerateId(); |
| 95 factory_.Create(delegated_local_frame_id_); | 94 factory_.Create(delegated_local_frame_id_); |
| 96 last_swap_frame_size_ = frame_size; | 95 last_swap_frame_size_ = frame_size; |
| 97 } | 96 } |
| 98 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_), | 97 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_), |
| 99 frame.metadata.device_scale_factor); | 98 frame.metadata.device_scale_factor); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // This notification is not relevant to our client outside of tests. We | 137 // This notification is not relevant to our client outside of tests. We |
| 139 // unblock the client from DidDrawCallback() when the surface is going to | 138 // unblock the client from DidDrawCallback() when the surface is going to |
| 140 // be drawn. | 139 // be drawn. |
| 141 } | 140 } |
| 142 | 141 |
| 143 void DirectCompositorFrameSink::DidDrawCallback() { | 142 void DirectCompositorFrameSink::DidDrawCallback() { |
| 144 client_->DidReceiveCompositorFrameAck(); | 143 client_->DidReceiveCompositorFrameAck(); |
| 145 } | 144 } |
| 146 | 145 |
| 147 } // namespace cc | 146 } // namespace cc |
| OLD | NEW |