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

Unified Diff: ui/compositor/layer_owner.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
« no previous file with comments | « ui/compositor/layer_owner.h ('k') | ui/compositor/layer_owner_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_owner.cc
diff --git a/ui/compositor/layer_owner.cc b/ui/compositor/layer_owner.cc
deleted file mode 100644
index cd614b37d8dca3e7e11326c2777d0e72cd80336d..0000000000000000000000000000000000000000
--- a/ui/compositor/layer_owner.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/compositor/layer_owner.h"
-
-#include "ui/compositor/layer_owner_delegate.h"
-
-namespace ui {
-
-LayerOwner::LayerOwner() : layer_(NULL), layer_owner_delegate_(NULL) {
-}
-
-LayerOwner::~LayerOwner() {
-}
-
-void LayerOwner::SetLayer(Layer* layer) {
- DCHECK(!OwnsLayer());
- layer_owner_.reset(layer);
- layer_ = layer;
- layer_->owner_ = this;
-}
-
-scoped_ptr<Layer> LayerOwner::AcquireLayer() {
- if (layer_owner_)
- layer_owner_->owner_ = NULL;
- return layer_owner_.Pass();
-}
-
-scoped_ptr<Layer> LayerOwner::RecreateLayer() {
- scoped_ptr<ui::Layer> old_layer(AcquireLayer());
- if (!old_layer)
- return old_layer.Pass();
-
- LayerDelegate* old_delegate = old_layer->delegate();
- old_layer->set_delegate(NULL);
-
- const gfx::Rect layer_bounds(old_layer->bounds());
- Layer* new_layer = new ui::Layer(old_layer->type());
- SetLayer(new_layer);
- new_layer->SetVisible(old_layer->GetTargetVisibility());
- new_layer->SetOpacity(old_layer->GetTargetOpacity());
- new_layer->SetBounds(layer_bounds);
- new_layer->SetMasksToBounds(old_layer->GetMasksToBounds());
- new_layer->set_name(old_layer->name());
- new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely());
- new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely());
- new_layer->SetSubpixelPositionOffset(old_layer->subpixel_position_offset());
- SkRegion* alpha_shape = old_layer->alpha_shape();
- if (alpha_shape)
- new_layer->SetAlphaShape(make_scoped_ptr(new SkRegion(*alpha_shape)));
-
- // Install new layer as a sibling of the old layer, stacked below it.
- if (old_layer->parent()) {
- old_layer->parent()->Add(new_layer);
- old_layer->parent()->StackBelow(new_layer, old_layer.get());
- }
-
- // Migrate all the child layers over to the new layer. Copy the list because
- // the items are removed during iteration.
- std::vector<ui::Layer*> children_copy = old_layer->children();
- for (std::vector<ui::Layer*>::const_iterator it = children_copy.begin();
- it != children_copy.end();
- ++it) {
- ui::Layer* child = *it;
- new_layer->Add(child);
- }
-
- // Install the delegate last so that the delegate isn't notified as we copy
- // state to the new layer.
- new_layer->set_delegate(old_delegate);
-
- if (layer_owner_delegate_)
- layer_owner_delegate_->OnLayerRecreated(old_layer.get(), new_layer);
-
- return old_layer.Pass();
-}
-
-void LayerOwner::DestroyLayer() {
- layer_ = NULL;
- layer_owner_.reset();
-}
-
-bool LayerOwner::OwnsLayer() const {
- return !!layer_owner_;
-}
-
-} // namespace ui
« no previous file with comments | « ui/compositor/layer_owner.h ('k') | ui/compositor/layer_owner_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698