Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: ui/aura/local/compositor_frame_sink_local.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Address comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/local/compositor_frame_sink_local.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DCHECK(frame.metadata.begin_frame_ack.has_damage); 64 DCHECK(frame.metadata.begin_frame_ack.has_damage);
65 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, 65 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber,
66 frame.metadata.begin_frame_ack.sequence_number); 66 frame.metadata.begin_frame_ack.sequence_number);
67 67
68 cc::LocalSurfaceId old_local_surface_id = local_surface_id_; 68 cc::LocalSurfaceId old_local_surface_id = local_surface_id_;
69 if (!frame.render_pass_list.empty()) { 69 const auto& frame_size = frame.render_pass_list.back()->output_rect.size();
70 const auto& frame_size = frame.render_pass_list.back()->output_rect.size(); 70 if (frame_size != surface_size_ ||
71 if (frame_size != last_submitted_frame_size_ || 71 frame.metadata.device_scale_factor != device_scale_factor_ ||
72 !local_surface_id_.is_valid()) { 72 !local_surface_id_.is_valid()) {
73 last_submitted_frame_size_ = frame_size; 73 surface_size_ = frame_size;
74 local_surface_id_ = id_allocator_.GenerateId(); 74 device_scale_factor_ = frame.metadata.device_scale_factor;
75 } 75 local_surface_id_ = id_allocator_.GenerateId();
76 } 76 }
77 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); 77 bool result =
78 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame));
79 DCHECK(result);
78 80
79 if (local_surface_id_ != old_local_surface_id) { 81 if (local_surface_id_ != old_local_surface_id) {
80 surface_changed_callback_.Run( 82 surface_changed_callback_.Run(
81 cc::SurfaceId(frame_sink_id_, local_surface_id_), 83 cc::SurfaceId(frame_sink_id_, local_surface_id_), surface_size_);
82 last_submitted_frame_size_);
83 } 84 }
84 } 85 }
85 86
86 void CompositorFrameSinkLocal::DidNotProduceFrame( 87 void CompositorFrameSinkLocal::DidNotProduceFrame(
87 const cc::BeginFrameAck& ack) { 88 const cc::BeginFrameAck& ack) {
88 DCHECK(thread_checker_); 89 DCHECK(thread_checker_);
89 DCHECK(thread_checker_->CalledOnValidThread()); 90 DCHECK(thread_checker_->CalledOnValidThread());
90 DCHECK(!ack.has_damage); 91 DCHECK(!ack.has_damage);
91 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); 92 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number);
92 support_->DidNotProduceFrame(ack); 93 support_->DidNotProduceFrame(ack);
(...skipping 25 matching lines...) Expand all
118 client_->ReclaimResources(resources); 119 client_->ReclaimResources(resources);
119 } 120 }
120 121
121 void CompositorFrameSinkLocal::OnNeedsBeginFrames(bool needs_begin_frames) { 122 void CompositorFrameSinkLocal::OnNeedsBeginFrames(bool needs_begin_frames) {
122 DCHECK(thread_checker_); 123 DCHECK(thread_checker_);
123 DCHECK(thread_checker_->CalledOnValidThread()); 124 DCHECK(thread_checker_->CalledOnValidThread());
124 support_->SetNeedsBeginFrame(needs_begin_frames); 125 support_->SetNeedsBeginFrame(needs_begin_frames);
125 } 126 }
126 127
127 } // namespace aura 128 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/local/compositor_frame_sink_local.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698