| 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/display_compositor_frame_sink.h" | 5 #include "services/ui/surfaces/display_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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 DisplayCompositorFrameSink::~DisplayCompositorFrameSink() { | 83 DisplayCompositorFrameSink::~DisplayCompositorFrameSink() { |
| 84 display_compositor_->manager()->UnregisterSurfaceFactoryClient( | 84 display_compositor_->manager()->UnregisterSurfaceFactoryClient( |
| 85 frame_sink_id_); | 85 frame_sink_id_); |
| 86 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_); | 86 display_compositor_->manager()->InvalidateFrameSinkId(frame_sink_id_); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void DisplayCompositorFrameSink::SubmitCompositorFrame( | 89 void DisplayCompositorFrameSink::SubmitCompositorFrame( |
| 90 cc::CompositorFrame frame, | 90 cc::CompositorFrame frame, |
| 91 const base::Callback<void()>& callback) { | 91 const base::Callback<void()>& callback) { |
| 92 gfx::Size frame_size = | 92 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
| 93 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); | |
| 94 if (frame_size.IsEmpty() || frame_size != display_size_) { | 93 if (frame_size.IsEmpty() || frame_size != display_size_) { |
| 95 if (!local_frame_id_.is_null()) | 94 if (!local_frame_id_.is_null()) |
| 96 factory_.Destroy(local_frame_id_); | 95 factory_.Destroy(local_frame_id_); |
| 97 local_frame_id_ = allocator_.GenerateId(); | 96 local_frame_id_ = allocator_.GenerateId(); |
| 98 factory_.Create(local_frame_id_); | 97 factory_.Create(local_frame_id_); |
| 99 display_size_ = frame_size; | 98 display_size_ = frame_size; |
| 100 display_->Resize(display_size_); | 99 display_->Resize(display_size_); |
| 101 } | 100 } |
| 102 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, local_frame_id_), | 101 display_->SetSurfaceId(cc::SurfaceId(frame_sink_id_, local_frame_id_), |
| 103 frame.metadata.device_scale_factor); | 102 frame.metadata.device_scale_factor); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 126 // This notification is not relevant to our client outside of tests. | 125 // This notification is not relevant to our client outside of tests. |
| 127 } | 126 } |
| 128 | 127 |
| 129 void DisplayCompositorFrameSink::DisplayDidDrawAndSwap() { | 128 void DisplayCompositorFrameSink::DisplayDidDrawAndSwap() { |
| 130 // This notification is not relevant to our client outside of tests. We | 129 // This notification is not relevant to our client outside of tests. We |
| 131 // unblock the client from the DrawCallback when the surface is going to | 130 // unblock the client from the DrawCallback when the surface is going to |
| 132 // be drawn. | 131 // be drawn. |
| 133 } | 132 } |
| 134 | 133 |
| 135 } // namespace ui | 134 } // namespace ui |
| OLD | NEW |