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

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

Issue 2686243002: content/ui[Android]: Remove ContextProviderFactory. (Closed)
Patch Set: Addressed comments. Created 3 years, 10 months 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 "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/surface.h" 14 #include "cc/surfaces/surface.h"
15 #include "cc/surfaces/surface_id.h" 15 #include "cc/surfaces/surface_id.h"
16 #include "cc/surfaces/surface_id_allocator.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"
19 #include "ui/android/view_android.h" 18 #include "ui/android/view_android.h"
20 #include "ui/android/window_android_compositor.h" 19 #include "ui/android/window_android_compositor.h"
21 #include "ui/display/display.h" 20 #include "ui/display/display.h"
22 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
23 #include "ui/gfx/geometry/dip_util.h" 22 #include "ui/gfx/geometry/dip_util.h"
24 23
25 namespace ui { 24 namespace ui {
26 25
27 namespace { 26 namespace {
28 27
(...skipping 17 matching lines...) Expand all
46 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback, 45 cc::CopyOutputRequest::CopyOutputRequestCallback result_callback,
47 std::unique_ptr<cc::CopyOutputResult> copy_output_result) { 46 std::unique_ptr<cc::CopyOutputResult> copy_output_result) {
48 readback_layer->RemoveFromParent(); 47 readback_layer->RemoveFromParent();
49 result_callback.Run(std::move(copy_output_result)); 48 result_callback.Run(std::move(copy_output_result));
50 } 49 }
51 50
52 } // namespace 51 } // namespace
53 52
54 DelegatedFrameHostAndroid::DelegatedFrameHostAndroid( 53 DelegatedFrameHostAndroid::DelegatedFrameHostAndroid(
55 ui::ViewAndroid* view, 54 ui::ViewAndroid* view,
55 cc::SurfaceManager* surface_manager,
56 SkColor background_color, 56 SkColor background_color,
57 Client* client, 57 Client* client,
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 surface_manager_(surface_manager),
61 client_(client), 62 client_(client),
62 background_layer_(cc::SolidColorLayer::Create()) { 63 background_layer_(cc::SolidColorLayer::Create()) {
63 DCHECK(view_); 64 DCHECK(view_);
64 DCHECK(client_); 65 DCHECK(client_);
65 66
66 surface_manager_ =
67 ui::ContextProviderFactory::GetInstance()->GetSurfaceManager();
68 surface_id_allocator_.reset(new cc::SurfaceIdAllocator()); 67 surface_id_allocator_.reset(new cc::SurfaceIdAllocator());
69 surface_manager_->RegisterFrameSinkId(frame_sink_id_); 68 surface_manager_->RegisterFrameSinkId(frame_sink_id_);
70 surface_factory_ = base::WrapUnique( 69 surface_factory_ = base::WrapUnique(
71 new cc::SurfaceFactory(frame_sink_id_, surface_manager_, this)); 70 new cc::SurfaceFactory(frame_sink_id_, surface_manager_, this));
72 71
73 background_layer_->SetBackgroundColor(background_color); 72 background_layer_->SetBackgroundColor(background_color);
74 view_->GetLayer()->AddChild(background_layer_); 73 view_->GetLayer()->AddChild(background_layer_);
75 UpdateBackgroundLayer(); 74 UpdateBackgroundLayer();
76 } 75 }
77 76
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 content_size_in_dip.width() < container_size_in_dip_.width() || 245 content_size_in_dip.width() < container_size_in_dip_.width() ||
247 content_size_in_dip.height() < container_size_in_dip_.height(); 246 content_size_in_dip.height() < container_size_in_dip_.height();
248 } else { 247 } else {
249 background_is_drawable = true; 248 background_is_drawable = true;
250 } 249 }
251 250
252 background_layer_->SetIsDrawable(background_is_drawable); 251 background_layer_->SetIsDrawable(background_is_drawable);
253 } 252 }
254 253
255 } // namespace ui 254 } // namespace ui
OLDNEW
« tools/metrics/histograms/histograms.xml ('K') | « ui/android/delegated_frame_host_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698