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

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

Issue 2905523003: Revert of Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: 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 const auto& frame_size = frame.render_pass_list.back()->output_rect.size(); 69 if (!frame.render_pass_list.empty()) {
70 if (frame_size != surface_size_ || 70 const auto& frame_size = frame.render_pass_list.back()->output_rect.size();
71 frame.metadata.device_scale_factor != device_scale_factor_ || 71 if (frame_size != last_submitted_frame_size_ ||
72 !local_surface_id_.is_valid()) { 72 !local_surface_id_.is_valid()) {
73 surface_size_ = frame_size; 73 last_submitted_frame_size_ = frame_size;
74 device_scale_factor_ = frame.metadata.device_scale_factor; 74 local_surface_id_ = id_allocator_.GenerateId();
75 local_surface_id_ = id_allocator_.GenerateId(); 75 }
76 } 76 }
77 bool result = 77 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame));
78 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame));
79 DCHECK(result);
80 78
81 if (local_surface_id_ != old_local_surface_id) { 79 if (local_surface_id_ != old_local_surface_id) {
82 surface_changed_callback_.Run( 80 surface_changed_callback_.Run(
83 cc::SurfaceId(frame_sink_id_, local_surface_id_), surface_size_); 81 cc::SurfaceId(frame_sink_id_, local_surface_id_),
82 last_submitted_frame_size_);
84 } 83 }
85 } 84 }
86 85
87 void CompositorFrameSinkLocal::DidNotProduceFrame( 86 void CompositorFrameSinkLocal::DidNotProduceFrame(
88 const cc::BeginFrameAck& ack) { 87 const cc::BeginFrameAck& ack) {
89 DCHECK(thread_checker_); 88 DCHECK(thread_checker_);
90 DCHECK(thread_checker_->CalledOnValidThread()); 89 DCHECK(thread_checker_->CalledOnValidThread());
91 DCHECK(!ack.has_damage); 90 DCHECK(!ack.has_damage);
92 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); 91 DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number);
93 support_->DidNotProduceFrame(ack); 92 support_->DidNotProduceFrame(ack);
(...skipping 25 matching lines...) Expand all
119 client_->ReclaimResources(resources); 118 client_->ReclaimResources(resources);
120 } 119 }
121 120
122 void CompositorFrameSinkLocal::OnNeedsBeginFrames(bool needs_begin_frames) { 121 void CompositorFrameSinkLocal::OnNeedsBeginFrames(bool needs_begin_frames) {
123 DCHECK(thread_checker_); 122 DCHECK(thread_checker_);
124 DCHECK(thread_checker_->CalledOnValidThread()); 123 DCHECK(thread_checker_->CalledOnValidThread());
125 support_->SetNeedsBeginFrame(needs_begin_frames); 124 support_->SetNeedsBeginFrame(needs_begin_frames);
126 } 125 }
127 126
128 } // namespace aura 127 } // 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