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

Unified Diff: cc/layers/ui_resource_layer.cc

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « cc/layers/ui_resource_layer.h ('k') | cc/layers/ui_resource_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/ui_resource_layer.cc
diff --git a/cc/layers/ui_resource_layer.cc b/cc/layers/ui_resource_layer.cc
index 944cf7d54844c7016feb32eacfc401fb590146ab..9d711feb61e4054a17ca81d620a925fdaeca1613 100644
--- a/cc/layers/ui_resource_layer.cc
+++ b/cc/layers/ui_resource_layer.cc
@@ -107,23 +107,26 @@ void UIResourceLayer::SetLayerTreeHost(LayerTreeHost* host) {
Layer::SetLayerTreeHost(host);
- // Recreate the resource hold against the new LTH.
+ // Recreate the resource held against the new LTH.
RecreateUIResourceHolder();
+
+ UpdateDrawsContent(HasDrawableContent());
}
void UIResourceLayer::RecreateUIResourceHolder() {
- ui_resource_holder_ = nullptr;
+ if (!bitmap_.empty())
+ SetBitmap(bitmap_);
+}
+
+void UIResourceLayer::SetBitmap(const SkBitmap& skbitmap) {
+ bitmap_ = skbitmap;
if (layer_tree_host() && !bitmap_.empty()) {
ui_resource_holder_ =
ScopedUIResourceHolder::Create(layer_tree_host(), bitmap_);
+ } else {
+ ui_resource_holder_ = nullptr;
}
UpdateDrawsContent(HasDrawableContent());
-}
-
-void UIResourceLayer::SetBitmap(const SkBitmap& skbitmap) {
- bitmap_ = skbitmap;
-
- RecreateUIResourceHolder();
SetNeedsCommit();
}
« no previous file with comments | « cc/layers/ui_resource_layer.h ('k') | cc/layers/ui_resource_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698