OLD | NEW |
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 Loading... |
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); |
132 | 133 |
133 current_frame_->surface_size = surface_size; | 134 current_frame_->surface_size = surface_size; |
134 current_frame_->top_controls_height = frame.metadata.top_controls_height; | 135 current_frame_->top_controls_height = frame.metadata.top_controls_height; |
135 current_frame_->top_controls_shown_ratio = | 136 current_frame_->top_controls_shown_ratio = |
136 frame.metadata.top_controls_shown_ratio; | 137 frame.metadata.top_controls_shown_ratio; |
137 current_frame_->bottom_controls_height = | 138 current_frame_->bottom_controls_height = |
138 frame.metadata.bottom_controls_height; | 139 frame.metadata.bottom_controls_height; |
139 current_frame_->bottom_controls_shown_ratio = | 140 current_frame_->bottom_controls_shown_ratio = |
140 frame.metadata.bottom_controls_shown_ratio; | 141 frame.metadata.bottom_controls_shown_ratio; |
141 current_frame_->has_transparent_background = | 142 current_frame_->has_transparent_background = |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 185 } |
185 | 186 |
186 void DelegatedFrameHostAndroid::DestroyDelegatedContent() { | 187 void DelegatedFrameHostAndroid::DestroyDelegatedContent() { |
187 if (!current_frame_) | 188 if (!current_frame_) |
188 return; | 189 return; |
189 | 190 |
190 DCHECK(content_layer_); | 191 DCHECK(content_layer_); |
191 | 192 |
192 content_layer_->RemoveFromParent(); | 193 content_layer_->RemoveFromParent(); |
193 content_layer_ = nullptr; | 194 content_layer_ = nullptr; |
194 surface_factory_->EvictSurface(); | 195 surface_factory_->Destroy(current_frame_->local_frame_id); |
195 current_frame_.reset(); | 196 current_frame_.reset(); |
196 | 197 |
197 UpdateBackgroundLayer(); | 198 UpdateBackgroundLayer(); |
198 } | 199 } |
199 | 200 |
200 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { | 201 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { |
201 return current_frame_.get() != nullptr; | 202 return current_frame_.get() != nullptr; |
202 } | 203 } |
203 | 204 |
204 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { | 205 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 content_size_in_dip.width() < container_size_in_dip_.width() || | 263 content_size_in_dip.width() < container_size_in_dip_.width() || |
263 content_size_in_dip.height() < container_size_in_dip_.height(); | 264 content_size_in_dip.height() < container_size_in_dip_.height(); |
264 } else { | 265 } else { |
265 background_is_drawable = true; | 266 background_is_drawable = true; |
266 } | 267 } |
267 | 268 |
268 background_layer_->SetIsDrawable(background_is_drawable); | 269 background_layer_->SetIsDrawable(background_is_drawable); |
269 } | 270 } |
270 | 271 |
271 } // namespace ui | 272 } // namespace ui |
OLD | NEW |