OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ui/aura/local/compositor_frame_sink_local.h" | 5 #include "ui/aura/local/compositor_frame_sink_local.h" |
6 | 6 |
7 #include "cc/output/compositor_frame_sink_client.h" | 7 #include "cc/output/compositor_frame_sink_client.h" |
8 #include "cc/surfaces/compositor_frame_sink_support.h" | 8 #include "cc/surfaces/compositor_frame_sink_support.h" |
9 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 thread_checker_.reset(); | 56 thread_checker_.reset(); |
57 cc::CompositorFrameSink::DetachFromClient(); | 57 cc::CompositorFrameSink::DetachFromClient(); |
58 } | 58 } |
59 | 59 |
60 void CompositorFrameSinkLocal::SubmitCompositorFrame( | 60 void CompositorFrameSinkLocal::SubmitCompositorFrame( |
61 cc::CompositorFrame frame) { | 61 cc::CompositorFrame frame) { |
62 DCHECK(thread_checker_); | 62 DCHECK(thread_checker_); |
63 DCHECK(thread_checker_->CalledOnValidThread()); | 63 DCHECK(thread_checker_->CalledOnValidThread()); |
64 | 64 |
65 cc::LocalSurfaceId old_local_surface_id = local_surface_id_; | 65 cc::LocalSurfaceId old_local_surface_id = local_surface_id_; |
66 if (!frame.render_pass_list.empty()) { | 66 const auto& frame_size = frame.render_pass_list.back()->output_rect.size(); |
67 const auto& frame_size = frame.render_pass_list.back()->output_rect.size(); | 67 if (frame_size != surface_size_ || |
68 if (frame_size != last_submitted_frame_size_ || | 68 frame.metadata.device_scale_factor != device_scale_factor_ || |
69 !local_surface_id_.is_valid()) { | 69 !local_surface_id_.is_valid()) { |
70 last_submitted_frame_size_ = frame_size; | 70 surface_size_ = frame_size; |
71 local_surface_id_ = id_allocator_.GenerateId(); | 71 device_scale_factor_ = frame.metadata.device_scale_factor; |
72 } | 72 local_surface_id_ = id_allocator_.GenerateId(); |
73 } | 73 } |
74 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); | 74 DCHECK(support_->SubmitCompositorFrame(local_surface_id_, std::move(frame))); |
danakj
2017/05/19 19:00:59
and here
Saman Sami
2017/05/19 19:26:47
Done.
| |
75 | 75 |
76 if (local_surface_id_ != old_local_surface_id) { | 76 if (local_surface_id_ != old_local_surface_id) { |
77 surface_changed_callback_.Run( | 77 surface_changed_callback_.Run( |
78 cc::SurfaceId(frame_sink_id_, local_surface_id_), | 78 cc::SurfaceId(frame_sink_id_, local_surface_id_), surface_size_); |
79 last_submitted_frame_size_); | |
80 } | 79 } |
81 } | 80 } |
82 | 81 |
83 void CompositorFrameSinkLocal::DidReceiveCompositorFrameAck( | 82 void CompositorFrameSinkLocal::DidReceiveCompositorFrameAck( |
84 const cc::ReturnedResourceArray& resources) { | 83 const cc::ReturnedResourceArray& resources) { |
85 DCHECK(thread_checker_); | 84 DCHECK(thread_checker_); |
86 DCHECK(thread_checker_->CalledOnValidThread()); | 85 DCHECK(thread_checker_->CalledOnValidThread()); |
87 if (!client_) | 86 if (!client_) |
88 return; | 87 return; |
89 if (!resources.empty()) | 88 if (!resources.empty()) |
(...skipping 24 matching lines...) Expand all Loading... | |
114 | 113 |
115 void CompositorFrameSinkLocal::OnDidFinishFrame(const cc::BeginFrameAck& ack) { | 114 void CompositorFrameSinkLocal::OnDidFinishFrame(const cc::BeginFrameAck& ack) { |
116 DCHECK(thread_checker_); | 115 DCHECK(thread_checker_); |
117 DCHECK(thread_checker_->CalledOnValidThread()); | 116 DCHECK(thread_checker_->CalledOnValidThread()); |
118 // If there was damage, the submitted CompositorFrame includes the ack. | 117 // If there was damage, the submitted CompositorFrame includes the ack. |
119 if (!ack.has_damage) | 118 if (!ack.has_damage) |
120 support_->BeginFrameDidNotSwap(ack); | 119 support_->BeginFrameDidNotSwap(ack); |
121 } | 120 } |
122 | 121 |
123 } // namespace aura | 122 } // namespace aura |
OLD | NEW |