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

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: tests Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index a3b1f9040d242e4c343aad3c37d22d79dace1b91..81cc5392a05e75858571b91b1bfbb8c2d136a7da 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -323,6 +323,7 @@ CompositorImpl::CompositorImpl(CompositorClient* client,
gfx::NativeWindow root_window)
: frame_sink_id_(
ui::ContextProviderFactory::GetInstance()->AllocateFrameSinkId()),
+ root_layer_(cc::Layer::Create()),
resource_manager_(root_window),
device_scale_factor_(1),
window_(NULL),
@@ -339,11 +340,9 @@ CompositorImpl::CompositorImpl(CompositorClient* client,
->RegisterFrameSinkId(frame_sink_id_);
DCHECK(client);
DCHECK(root_window);
- DCHECK(root_window->GetLayer() == nullptr);
- root_window->SetLayer(cc::Layer::Create());
readback_layer_tree_ = cc::Layer::Create();
readback_layer_tree_->SetHideLayerAndSubtree(true);
- root_window->GetLayer()->AddChild(readback_layer_tree_);
+ root_layer_->AddChild(readback_layer_tree_);
root_window->AttachCompositor(this);
CreateLayerTreeHost();
resource_manager_.Init(host_->GetUIResourceManager());
@@ -351,7 +350,6 @@ CompositorImpl::CompositorImpl(CompositorClient* client,
CompositorImpl::~CompositorImpl() {
root_window_->DetachCompositor();
- root_window_->SetLayer(nullptr);
// Clean-up any surface references.
SetSurface(NULL);
ui::ContextProviderFactory::GetInstance()
@@ -372,9 +370,9 @@ void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) {
subroot_layer_->RemoveFromParent();
subroot_layer_ = NULL;
}
- if (root_window_->GetLayer()) {
- subroot_layer_ = root_window_->GetLayer();
- root_window_->GetLayer()->AddChild(root_layer);
+ if (root_layer.get()) {
+ subroot_layer_ = root_layer;
+ root_layer_->AddChild(root_layer);
}
}
@@ -439,7 +437,7 @@ void CompositorImpl::CreateLayerTreeHost() {
params.mutator_host = animation_host_.get();
host_ = cc::LayerTreeHostInProcess::CreateSingleThreaded(this, &params);
DCHECK(!host_->IsVisible());
- host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer());
+ host_->GetLayerTree()->SetRootLayer(root_layer_);
host_->SetFrameSinkId(frame_sink_id_);
host_->GetLayerTree()->SetViewportSize(size_);
SetHasTransparentBackground(false);
@@ -486,7 +484,7 @@ void CompositorImpl::SetWindowBounds(const gfx::Size& size) {
host_->GetLayerTree()->SetViewportSize(size);
if (display_)
display_->Resize(size);
- root_window_->GetLayer()->SetBounds(size);
+ root_layer_->SetBounds(size);
}
void CompositorImpl::SetHasTransparentBackground(bool transparent) {
@@ -720,7 +718,7 @@ void CompositorImpl::AttachLayerForReadback(scoped_refptr<cc::Layer> layer) {
void CompositorImpl::RequestCopyOfOutputOnRootLayer(
std::unique_ptr<cc::CopyOutputRequest> request) {
- root_window_->GetLayer()->RequestCopyOfOutput(std::move(request));
+ root_layer_->RequestCopyOfOutput(std::move(request));
}
void CompositorImpl::SetNeedsAnimate() {

Powered by Google App Engine
This is Rietveld 408576698