| 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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
| 11 #include "cc/layers/surface_layer.h" | 11 #include "cc/layers/surface_layer.h" |
| 12 #include "cc/output/compositor_frame.h" | 12 #include "cc/output/compositor_frame.h" |
| 13 #include "cc/output/copy_output_result.h" | 13 #include "cc/output/copy_output_result.h" |
| 14 #include "cc/surfaces/local_surface_id_allocator.h" |
| 14 #include "cc/surfaces/surface.h" | 15 #include "cc/surfaces/surface.h" |
| 15 #include "cc/surfaces/surface_id.h" | 16 #include "cc/surfaces/surface_id.h" |
| 16 #include "cc/surfaces/surface_id_allocator.h" | |
| 17 #include "cc/surfaces/surface_manager.h" | 17 #include "cc/surfaces/surface_manager.h" |
| 18 #include "ui/android/context_provider_factory.h" | 18 #include "ui/android/context_provider_factory.h" |
| 19 #include "ui/android/view_android.h" | 19 #include "ui/android/view_android.h" |
| 20 #include "ui/android/window_android_compositor.h" | 20 #include "ui/android/window_android_compositor.h" |
| 21 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
| 22 #include "ui/display/screen.h" | 22 #include "ui/display/screen.h" |
| 23 #include "ui/gfx/geometry/dip_util.h" | 23 #include "ui/gfx/geometry/dip_util.h" |
| 24 | 24 |
| 25 namespace ui { | 25 namespace ui { |
| 26 | 26 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const cc::FrameSinkId& frame_sink_id) | 58 const cc::FrameSinkId& frame_sink_id) |
| 59 : frame_sink_id_(frame_sink_id), | 59 : frame_sink_id_(frame_sink_id), |
| 60 view_(view), | 60 view_(view), |
| 61 client_(client), | 61 client_(client), |
| 62 background_layer_(cc::SolidColorLayer::Create()) { | 62 background_layer_(cc::SolidColorLayer::Create()) { |
| 63 DCHECK(view_); | 63 DCHECK(view_); |
| 64 DCHECK(client_); | 64 DCHECK(client_); |
| 65 | 65 |
| 66 surface_manager_ = | 66 surface_manager_ = |
| 67 ui::ContextProviderFactory::GetInstance()->GetSurfaceManager(); | 67 ui::ContextProviderFactory::GetInstance()->GetSurfaceManager(); |
| 68 surface_id_allocator_.reset(new cc::SurfaceIdAllocator()); | 68 local_surface_id_allocator_.reset(new cc::LocalSurfaceIdAllocator()); |
| 69 surface_manager_->RegisterFrameSinkId(frame_sink_id_); | 69 surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
| 70 surface_factory_ = base::WrapUnique( | 70 surface_factory_ = base::WrapUnique( |
| 71 new cc::SurfaceFactory(frame_sink_id_, surface_manager_, this)); | 71 new cc::SurfaceFactory(frame_sink_id_, surface_manager_, this)); |
| 72 | 72 |
| 73 background_layer_->SetBackgroundColor(background_color); | 73 background_layer_->SetBackgroundColor(background_color); |
| 74 view_->GetLayer()->AddChild(background_layer_); | 74 view_->GetLayer()->AddChild(background_layer_); |
| 75 UpdateBackgroundLayer(); | 75 UpdateBackgroundLayer(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 DelegatedFrameHostAndroid::~DelegatedFrameHostAndroid() { | 78 DelegatedFrameHostAndroid::~DelegatedFrameHostAndroid() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 103 current_frame_->bottom_controls_shown_ratio != | 103 current_frame_->bottom_controls_shown_ratio != |
| 104 frame.metadata.bottom_controls_shown_ratio || | 104 frame.metadata.bottom_controls_shown_ratio || |
| 105 current_frame_->viewport_selection != frame.metadata.selection || | 105 current_frame_->viewport_selection != frame.metadata.selection || |
| 106 current_frame_->has_transparent_background != | 106 current_frame_->has_transparent_background != |
| 107 root_pass->has_transparent_background) { | 107 root_pass->has_transparent_background) { |
| 108 DestroyDelegatedContent(); | 108 DestroyDelegatedContent(); |
| 109 DCHECK(!content_layer_); | 109 DCHECK(!content_layer_); |
| 110 DCHECK(!current_frame_); | 110 DCHECK(!current_frame_); |
| 111 | 111 |
| 112 current_frame_ = base::MakeUnique<FrameData>(); | 112 current_frame_ = base::MakeUnique<FrameData>(); |
| 113 current_frame_->local_surface_id = surface_id_allocator_->GenerateId(); | 113 current_frame_->local_surface_id = |
| 114 local_surface_id_allocator_->GenerateId(); |
| 114 current_frame_->surface_size = surface_size; | 115 current_frame_->surface_size = surface_size; |
| 115 current_frame_->top_controls_height = frame.metadata.top_controls_height; | 116 current_frame_->top_controls_height = frame.metadata.top_controls_height; |
| 116 current_frame_->top_controls_shown_ratio = | 117 current_frame_->top_controls_shown_ratio = |
| 117 frame.metadata.top_controls_shown_ratio; | 118 frame.metadata.top_controls_shown_ratio; |
| 118 current_frame_->bottom_controls_height = | 119 current_frame_->bottom_controls_height = |
| 119 frame.metadata.bottom_controls_height; | 120 frame.metadata.bottom_controls_height; |
| 120 current_frame_->bottom_controls_shown_ratio = | 121 current_frame_->bottom_controls_shown_ratio = |
| 121 frame.metadata.bottom_controls_shown_ratio; | 122 frame.metadata.bottom_controls_shown_ratio; |
| 122 current_frame_->has_transparent_background = | 123 current_frame_->has_transparent_background = |
| 123 root_pass->has_transparent_background; | 124 root_pass->has_transparent_background; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 content_size_in_dip.width() < container_size_in_dip_.width() || | 247 content_size_in_dip.width() < container_size_in_dip_.width() || |
| 247 content_size_in_dip.height() < container_size_in_dip_.height(); | 248 content_size_in_dip.height() < container_size_in_dip_.height(); |
| 248 } else { | 249 } else { |
| 249 background_is_drawable = true; | 250 background_is_drawable = true; |
| 250 } | 251 } |
| 251 | 252 |
| 252 background_layer_->SetIsDrawable(background_is_drawable); | 253 background_layer_->SetIsDrawable(background_is_drawable); |
| 253 } | 254 } |
| 254 | 255 |
| 255 } // namespace ui | 256 } // namespace ui |
| OLD | NEW |