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

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

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: up 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 frame.metadata.bottom_controls_shown_ratio || 125 frame.metadata.bottom_controls_shown_ratio ||
126 current_frame_->viewport_selection != frame.metadata.selection || 126 current_frame_->viewport_selection != frame.metadata.selection ||
127 current_frame_->has_transparent_background != 127 current_frame_->has_transparent_background !=
128 root_pass->has_transparent_background) { 128 root_pass->has_transparent_background) {
129 DestroyDelegatedContent(); 129 DestroyDelegatedContent();
130 DCHECK(!content_layer_); 130 DCHECK(!content_layer_);
131 DCHECK(!current_frame_); 131 DCHECK(!current_frame_);
132 132
133 current_frame_ = base::MakeUnique<FrameData>(); 133 current_frame_ = base::MakeUnique<FrameData>();
134 current_frame_->local_frame_id = surface_id_allocator_->GenerateId(); 134 current_frame_->local_frame_id = surface_id_allocator_->GenerateId();
135 surface_factory_->Create(current_frame_->local_frame_id);
136 135
137 current_frame_->surface_size = surface_size; 136 current_frame_->surface_size = surface_size;
138 current_frame_->top_controls_height = frame.metadata.top_controls_height; 137 current_frame_->top_controls_height = frame.metadata.top_controls_height;
139 current_frame_->top_controls_shown_ratio = 138 current_frame_->top_controls_shown_ratio =
140 frame.metadata.top_controls_shown_ratio; 139 frame.metadata.top_controls_shown_ratio;
141 current_frame_->bottom_controls_height = 140 current_frame_->bottom_controls_height =
142 frame.metadata.bottom_controls_height; 141 frame.metadata.bottom_controls_height;
143 current_frame_->bottom_controls_shown_ratio = 142 current_frame_->bottom_controls_shown_ratio =
144 frame.metadata.bottom_controls_shown_ratio; 143 frame.metadata.bottom_controls_shown_ratio;
145 current_frame_->has_transparent_background = 144 current_frame_->has_transparent_background =
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 188
190 void DelegatedFrameHostAndroid::DestroyDelegatedContent() { 189 void DelegatedFrameHostAndroid::DestroyDelegatedContent() {
191 if (!current_frame_) 190 if (!current_frame_)
192 return; 191 return;
193 192
194 DCHECK(surface_factory_.get()); 193 DCHECK(surface_factory_.get());
195 DCHECK(content_layer_); 194 DCHECK(content_layer_);
196 195
197 content_layer_->RemoveFromParent(); 196 content_layer_->RemoveFromParent();
198 content_layer_ = nullptr; 197 content_layer_ = nullptr;
199 surface_factory_->Destroy(current_frame_->local_frame_id);
200 current_frame_.reset(); 198 current_frame_.reset();
201 199
202 UpdateBackgroundLayer(); 200 UpdateBackgroundLayer();
203 } 201 }
204 202
205 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { 203 bool DelegatedFrameHostAndroid::HasDelegatedContent() const {
206 return current_frame_.get() != nullptr; 204 return current_frame_.get() != nullptr;
207 } 205 }
208 206
209 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { 207 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 content_size_in_dip.width() < container_size_in_dip_.width() || 265 content_size_in_dip.width() < container_size_in_dip_.width() ||
268 content_size_in_dip.height() < container_size_in_dip_.height(); 266 content_size_in_dip.height() < container_size_in_dip_.height();
269 } else { 267 } else {
270 background_is_drawable = true; 268 background_is_drawable = true;
271 } 269 }
272 270
273 background_layer_->SetIsDrawable(background_is_drawable); 271 background_layer_->SetIsDrawable(background_is_drawable);
274 } 272 }
275 273
276 } // namespace ui 274 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698