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

Unified Diff: cc/test/fake_scoped_ui_resource.cc

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 7 years, 3 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 | « cc/test/fake_scoped_ui_resource.h ('k') | cc/test/layer_tree_json_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_scoped_ui_resource.cc
diff --git a/cc/test/fake_scoped_ui_resource.cc b/cc/test/fake_scoped_ui_resource.cc
index ce5ee1127c885f19fa8767fdd36dd3a2a9f1009e..bf86f5469b90a98c64655df69f5b219a47176288 100644
--- a/cc/test/fake_scoped_ui_resource.cc
+++ b/cc/test/fake_scoped_ui_resource.cc
@@ -8,25 +8,34 @@
namespace cc {
+namespace {
+
+UIResourceBitmap CreateMockUIResourceBitmap() {
+ SkBitmap skbitmap;
+ skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
+ skbitmap.allocPixels();
+ skbitmap.setImmutable();
+ return UIResourceBitmap(skbitmap);
+}
+
+} // anonymous namespace
+
scoped_ptr<FakeScopedUIResource> FakeScopedUIResource::Create(
LayerTreeHost* host) {
return make_scoped_ptr(new FakeScopedUIResource(host));
}
-FakeScopedUIResource::FakeScopedUIResource(LayerTreeHost* host) {
+FakeScopedUIResource::FakeScopedUIResource(LayerTreeHost* host)
+ : ScopedUIResource(host, CreateMockUIResourceBitmap()) {
+ // The constructor of ScopedUIResource already created a resource so we need
+ // to delete the created resource to wipe the state clean.
+ host_->DeleteUIResource(id_);
ResetCounters();
- bitmap_ = UIResourceBitmap::Create(
- new uint8_t[1],
- UIResourceBitmap::RGBA8,
- UIResourceBitmap::CLAMP_TO_EDGE,
- gfx::Size(1, 1));
- host_ = host;
id_ = host_->CreateUIResource(this);
}
-scoped_refptr<UIResourceBitmap> FakeScopedUIResource::GetBitmap(
- UIResourceId uid,
- bool resource_lost) {
+UIResourceBitmap FakeScopedUIResource::GetBitmap(UIResourceId uid,
+ bool resource_lost) {
resource_create_count++;
if (resource_lost)
lost_resource_count++;
« no previous file with comments | « cc/test/fake_scoped_ui_resource.h ('k') | cc/test/layer_tree_json_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698