| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/surfaces/compositor_frame_sink.h" | 5 #include "services/ui/surfaces/compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "cc/output/copy_output_request.h" | 7 #include "cc/output/copy_output_request.h" |
| 8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
| 9 #include "cc/output/renderer_settings.h" | 9 #include "cc/output/renderer_settings.h" |
| 10 #include "cc/output/texture_mailbox_deleter.h" | 10 #include "cc/output/texture_mailbox_deleter.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 frame_sink_id_); | 86 frame_sink_id_); |
| 87 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_); | 87 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void CompositorFrameSink::SubmitCompositorFrame( | 90 void CompositorFrameSink::SubmitCompositorFrame( |
| 91 cc::CompositorFrame frame, | 91 cc::CompositorFrame frame, |
| 92 const base::Callback<void()>& callback) { | 92 const base::Callback<void()>& callback) { |
| 93 gfx::Size frame_size = | 93 gfx::Size frame_size = |
| 94 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); | 94 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); |
| 95 if (frame_size.IsEmpty() || frame_size != display_size_) { | 95 if (frame_size.IsEmpty() || frame_size != display_size_) { |
| 96 if (!local_frame_id_.is_null()) | 96 if (local_frame_id_.is_valid()) |
| 97 factory_.Destroy(local_frame_id_); | 97 factory_.Destroy(local_frame_id_); |
| 98 local_frame_id_ = allocator_.GenerateId(); | 98 local_frame_id_ = allocator_.GenerateId(); |
| 99 factory_.Create(local_frame_id_); | 99 factory_.Create(local_frame_id_); |
| 100 display_size_ = frame_size; | 100 display_size_ = frame_size; |
| 101 display_->Resize(display_size_); | 101 display_->Resize(display_size_); |
| 102 } | 102 } |
| 103 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, local_frame_id_), | 103 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, local_frame_id_), |
| 104 frame.metadata.device_scale_factor); | 104 frame.metadata.device_scale_factor); |
| 105 factory_.SubmitCompositorFrame(local_frame_id_, std::move(frame), callback); | 105 factory_.SubmitCompositorFrame(local_frame_id_, std::move(frame), callback); |
| 106 } | 106 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 void CompositorFrameSink::DisplayDidDrawAndSwap() { | 135 void CompositorFrameSink::DisplayDidDrawAndSwap() { |
| 136 // This notification is not relevant to our client outside of tests. We | 136 // This notification is not relevant to our client outside of tests. We |
| 137 // unblock the client from the DrawCallback when the surface is going to | 137 // unblock the client from the DrawCallback when the surface is going to |
| 138 // be drawn. | 138 // be drawn. |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace surfaces | 141 } // namespace surfaces |
| 142 } // namespace ui | 142 } // namespace ui |
| OLD | NEW |