OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/test/fake_scoped_ui_resource.h" | 5 #include "cc/test/fake_scoped_ui_resource.h" |
6 | 6 |
7 #include "cc/trees/layer_tree_host.h" | 7 #include "cc/trees/layer_tree_host.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 UIResourceBitmap CreateMockUIResourceBitmap() { | 13 UIResourceBitmap CreateMockUIResourceBitmap() { return UIResourceBitmap(1, 1); } |
14 SkBitmap skbitmap; | |
15 skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); | |
16 skbitmap.allocPixels(); | |
17 skbitmap.setImmutable(); | |
18 return UIResourceBitmap(skbitmap); | |
19 } | |
20 | 14 |
21 } // anonymous namespace | 15 } // anonymous namespace |
22 | 16 |
23 scoped_ptr<FakeScopedUIResource> FakeScopedUIResource::Create( | 17 scoped_ptr<FakeScopedUIResource> FakeScopedUIResource::Create( |
24 LayerTreeHost* host) { | 18 LayerTreeHost* host) { |
25 return make_scoped_ptr(new FakeScopedUIResource(host)); | 19 return make_scoped_ptr(new FakeScopedUIResource(host)); |
26 } | 20 } |
27 | 21 |
28 FakeScopedUIResource::FakeScopedUIResource(LayerTreeHost* host) | 22 FakeScopedUIResource::FakeScopedUIResource(LayerTreeHost* host) |
29 : ScopedUIResource(host, CreateMockUIResourceBitmap()) { | 23 : ScopedUIResource(host, CreateMockUIResourceBitmap()) { |
(...skipping 11 matching lines...) Expand all Loading... |
41 lost_resource_count++; | 35 lost_resource_count++; |
42 return ScopedUIResource::GetBitmap(uid, resource_lost); | 36 return ScopedUIResource::GetBitmap(uid, resource_lost); |
43 } | 37 } |
44 | 38 |
45 void FakeScopedUIResource::ResetCounters() { | 39 void FakeScopedUIResource::ResetCounters() { |
46 resource_create_count = 0; | 40 resource_create_count = 0; |
47 lost_resource_count = 0; | 41 lost_resource_count = 0; |
48 } | 42 } |
49 | 43 |
50 } // namespace cc | 44 } // namespace cc |
OLD | NEW |