| 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); | |
| 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 Loading... |
| 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); | 194 surface_factory_->EvictFrame(); |
| 196 current_frame_.reset(); | 195 current_frame_.reset(); |
| 197 | 196 |
| 198 UpdateBackgroundLayer(); | 197 UpdateBackgroundLayer(); |
| 199 } | 198 } |
| 200 | 199 |
| 201 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { | 200 bool DelegatedFrameHostAndroid::HasDelegatedContent() const { |
| 202 return current_frame_.get() != nullptr; | 201 return current_frame_.get() != nullptr; |
| 203 } | 202 } |
| 204 | 203 |
| 205 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { | 204 void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 content_size_in_dip.width() < container_size_in_dip_.width() || | 262 content_size_in_dip.width() < container_size_in_dip_.width() || |
| 264 content_size_in_dip.height() < container_size_in_dip_.height(); | 263 content_size_in_dip.height() < container_size_in_dip_.height(); |
| 265 } else { | 264 } else { |
| 266 background_is_drawable = true; | 265 background_is_drawable = true; |
| 267 } | 266 } |
| 268 | 267 |
| 269 background_layer_->SetIsDrawable(background_is_drawable); | 268 background_layer_->SetIsDrawable(background_is_drawable); |
| 270 } | 269 } |
| 271 | 270 |
| 272 } // namespace ui | 271 } // namespace ui |
| OLD | NEW |