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

Unified Diff: ui/wm/core/window_util.cc

Issue 1992853002: Create a LayerDelegate for recreated layers to draw when their content is invalidated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/wm/core/window_util.h ('k') | ui/wm/core/window_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/window_util.cc
diff --git a/ui/wm/core/window_util.cc b/ui/wm/core/window_util.cc
index b0cb19cd5ac59a011d5f53ec30c8b9710eadcc26..07723511c841a3fd3c58726520c205064cc1c062 100644
--- a/ui/wm/core/window_util.cc
+++ b/ui/wm/core/window_util.cc
@@ -16,7 +16,9 @@ namespace {
// cloned children to |parent|.
//
// WARNING: It is assumed that |parent| is ultimately owned by a LayerTreeOwner.
-void CloneChildren(ui::Layer* to_clone, ui::Layer* parent) {
+void CloneChildren(ui::Layer* to_clone,
+ ui::Layer* parent,
+ wm::LayerDelegateFactory* factory) {
typedef std::vector<ui::Layer*> Layers;
// Make a copy of the children since RecreateLayer() mutates it.
Layers children(to_clone->children());
@@ -24,10 +26,13 @@ void CloneChildren(ui::Layer* to_clone, ui::Layer* parent) {
ui::LayerOwner* owner = (*i)->owner();
ui::Layer* old_layer = owner ? owner->RecreateLayer().release() : NULL;
if (old_layer) {
+ if (factory && owner->layer()->delegate())
+ old_layer->set_delegate(
+ factory->CreateDelegate(owner->layer()->delegate()));
parent->Add(old_layer);
// RecreateLayer() moves the existing children to the new layer. Create a
// copy of those.
- CloneChildren(owner->layer(), old_layer);
+ CloneChildren(owner->layer(), old_layer, factory);
}
}
}
@@ -80,11 +85,18 @@ aura::Window* GetToplevelWindow(aura::Window* window) {
return client ? client->GetToplevelWindow(window) : NULL;
}
-std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(ui::LayerOwner* root) {
+std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(
+ ui::LayerOwner* root,
+ LayerDelegateFactory* factory) {
std::unique_ptr<ui::LayerTreeOwner> old_layer(
new ui::LayerTreeOwner(root->RecreateLayer().release()));
- if (old_layer->root())
- CloneChildren(root->layer(), old_layer->root());
+ if (old_layer->root()) {
+ if (factory) {
+ old_layer->root()->set_delegate(
+ factory->CreateDelegate(root->layer()->delegate()));
+ }
+ CloneChildren(root->layer(), old_layer->root(), factory);
+ }
return old_layer;
}
« no previous file with comments | « ui/wm/core/window_util.h ('k') | ui/wm/core/window_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698