| 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++;
|
|
|