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

Side by Side Diff: ui/android/delegated_frame_host_android.cc

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: SetPreviousFrame lint Created 4 years, 1 month 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
OLDNEW
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 "ui/android/delegated_frame_host_android.h" 5 #include "ui/android/delegated_frame_host_android.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "cc/layers/solid_color_layer.h" 9 #include "cc/layers/solid_color_layer.h"
10 #include "cc/layers/surface_layer.h" 10 #include "cc/layers/surface_layer.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 frame.metadata.bottom_controls_shown_ratio || 122 frame.metadata.bottom_controls_shown_ratio ||
123 current_frame_->viewport_selection != frame.metadata.selection || 123 current_frame_->viewport_selection != frame.metadata.selection ||
124 current_frame_->has_transparent_background != 124 current_frame_->has_transparent_background !=
125 root_pass->has_transparent_background) { 125 root_pass->has_transparent_background) {
126 DestroyDelegatedContent(); 126 DestroyDelegatedContent();
127 DCHECK(!content_layer_); 127 DCHECK(!content_layer_);
128 DCHECK(!current_frame_); 128 DCHECK(!current_frame_);
129 129
130 current_frame_ = base::MakeUnique<FrameData>(); 130 current_frame_ = base::MakeUnique<FrameData>();
131 current_frame_->local_frame_id = surface_id_allocator_->GenerateId(); 131 current_frame_->local_frame_id = surface_id_allocator_->GenerateId();
132 surface_factory_->Create(current_frame_->local_frame_id);
133 132
134 current_frame_->surface_size = surface_size; 133 current_frame_->surface_size = surface_size;
135 current_frame_->top_controls_height = frame.metadata.top_controls_height; 134 current_frame_->top_controls_height = frame.metadata.top_controls_height;
136 current_frame_->top_controls_shown_ratio = 135 current_frame_->top_controls_shown_ratio =
137 frame.metadata.top_controls_shown_ratio; 136 frame.metadata.top_controls_shown_ratio;
138 current_frame_->bottom_controls_height = 137 current_frame_->bottom_controls_height =
139 frame.metadata.bottom_controls_height; 138 frame.metadata.bottom_controls_height;
140 current_frame_->bottom_controls_shown_ratio = 139 current_frame_->bottom_controls_shown_ratio =
141 frame.metadata.bottom_controls_shown_ratio; 140 frame.metadata.bottom_controls_shown_ratio;
142 current_frame_->has_transparent_background = 141 current_frame_->has_transparent_background =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 184 }
186 185
187 void DelegatedFrameHostAndroid::DestroyDelegatedContent() { 186 void DelegatedFrameHostAndroid::DestroyDelegatedContent() {
188 if (!current_frame_) 187 if (!current_frame_)
189 return; 188 return;
190 189
191 DCHECK(content_layer_); 190 DCHECK(content_layer_);
192 191
193 content_layer_->RemoveFromParent(); 192 content_layer_->RemoveFromParent();
194 content_layer_ = nullptr; 193 content_layer_ = nullptr;
195 surface_factory_->Destroy(current_frame_->local_frame_id);
196 current_frame_.reset(); 194 current_frame_.reset();
197 195
198 UpdateBackgroundLayer(); 196 UpdateBackgroundLayer();
199 } 197 }
200 198
201 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { 199 bool DelegatedFrameHostAndroid::HasDelegatedContent() const {
202 return current_frame_.get() != nullptr; 200 return current_frame_.get() != nullptr;
203 } 201 }
204 202
205 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { 203 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 content_size_in_dip.width() < container_size_in_dip_.width() || 261 content_size_in_dip.width() < container_size_in_dip_.width() ||
264 content_size_in_dip.height() < container_size_in_dip_.height(); 262 content_size_in_dip.height() < container_size_in_dip_.height();
265 } else { 263 } else {
266 background_is_drawable = true; 264 background_is_drawable = true;
267 } 265 }
268 266
269 background_layer_->SetIsDrawable(background_is_drawable); 267 background_layer_->SetIsDrawable(background_is_drawable);
270 } 268 }
271 269
272 } // namespace ui 270 } // namespace ui
OLDNEW
« services/ui/ws/gpu_compositor_frame_sink.cc ('K') | « services/ui/ws/gpu_compositor_frame_sink.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698