OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/trace_event/memory_dump_manager.h" | 10 #include "base/trace_event/memory_dump_manager.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) { | 50 void SetResourceAsLoaded(AndroidResourceType res_type, int res_id) { |
51 SkBitmap small_bitmap; | 51 SkBitmap small_bitmap; |
52 SkCanvas canvas(small_bitmap); | 52 SkCanvas canvas(small_bitmap); |
53 small_bitmap.allocPixels( | 53 small_bitmap.allocPixels( |
54 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); | 54 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); |
55 canvas.drawColor(SK_ColorWHITE); | 55 canvas.drawColor(SK_ColorWHITE); |
56 small_bitmap.setImmutable(); | 56 small_bitmap.setImmutable(); |
57 | 57 |
58 OnResourceReady(nullptr, nullptr, res_type, res_id, | 58 OnResourceReady(nullptr, nullptr, res_type, res_id, |
59 gfx::ConvertToJavaBitmap(&small_bitmap), 0, 0, 0, 0, 0, 0, | 59 gfx::ConvertToJavaBitmap(&small_bitmap), |
60 0, 0); | 60 reinterpret_cast<intptr_t>(new Resource())); |
61 } | 61 } |
62 | 62 |
63 protected: | 63 protected: |
64 void PreloadResourceFromJava(AndroidResourceType res_type, | 64 void PreloadResourceFromJava(AndroidResourceType res_type, |
65 int res_id) override {} | 65 int res_id) override {} |
66 | 66 |
67 void RequestResourceFromJava(AndroidResourceType res_type, | 67 void RequestResourceFromJava(AndroidResourceType res_type, |
68 int res_id) override { | 68 int res_id) override { |
69 SetResourceAsLoaded(res_type, res_id); | 69 SetResourceAsLoaded(res_type, res_id); |
70 } | 70 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 ->system_allocator_pool_name(); | 195 ->system_allocator_pool_name(); |
196 size_t expected_dump_count = system_allocator_pool_name ? 2 : 1; | 196 size_t expected_dump_count = system_allocator_pool_name ? 2 : 1; |
197 EXPECT_EQ(expected_dump_count, allocator_dumps.size()); | 197 EXPECT_EQ(expected_dump_count, allocator_dumps.size()); |
198 for (const auto& dump : allocator_dumps) { | 198 for (const auto& dump : allocator_dumps) { |
199 ASSERT_TRUE(dump.first.find("ui/resource_manager") == 0 || | 199 ASSERT_TRUE(dump.first.find("ui/resource_manager") == 0 || |
200 dump.first.find(system_allocator_pool_name) == 0); | 200 dump.first.find(system_allocator_pool_name) == 0); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 } // namespace ui | 204 } // namespace ui |
OLD | NEW |