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 "cc/resources/ui_resource_bitmap.h" | 5 #include "cc/resources/ui_resource_bitmap.h" |
6 #include "content/browser/android/system_ui_resource_manager_impl.h" | 6 #include "content/browser/android/system_ui_resource_manager_impl.h" |
7 #include "content/public/browser/android/ui_resource_client_android.h" | 7 #include "content/public/browser/android/ui_resource_client_android.h" |
8 #include "content/public/browser/android/ui_resource_provider.h" | 8 #include "content/public/browser/android/ui_resource_provider.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 client->GetBitmap(id, false); | 56 client->GetBitmap(id, false); |
57 ui_resource_client_map_[id] = client; | 57 ui_resource_client_map_[id] = client; |
58 return id; | 58 return id; |
59 } | 59 } |
60 | 60 |
61 virtual void DeleteUIResource(cc::UIResourceId id) OVERRIDE { | 61 virtual void DeleteUIResource(cc::UIResourceId id) OVERRIDE { |
62 CHECK(has_layer_tree_host_); | 62 CHECK(has_layer_tree_host_); |
63 ui_resource_client_map_.erase(id); | 63 ui_resource_client_map_.erase(id); |
64 } | 64 } |
65 | 65 |
| 66 virtual bool SupportsETC1NonPowerOfTwo() const OVERRIDE { return true; } |
| 67 |
66 void LayerTreeHostCleared() { | 68 void LayerTreeHostCleared() { |
67 has_layer_tree_host_ = false; | 69 has_layer_tree_host_ = false; |
68 UIResourceClientMap client_map = ui_resource_client_map_; | 70 UIResourceClientMap client_map = ui_resource_client_map_; |
69 ui_resource_client_map_.clear(); | 71 ui_resource_client_map_.clear(); |
70 for (UIResourceClientMap::iterator iter = client_map.begin(); | 72 for (UIResourceClientMap::iterator iter = client_map.begin(); |
71 iter != client_map.end(); | 73 iter != client_map.end(); |
72 iter++) { | 74 iter++) { |
73 iter->second->UIResourceIsInvalid(); | 75 iter->second->UIResourceIsInvalid(); |
74 } | 76 } |
75 } | 77 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 160 |
159 SetResourceAsLoaded(TEST_RESOURCE_TYPE); | 161 SetResourceAsLoaded(TEST_RESOURCE_TYPE); |
160 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE)); | 162 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE)); |
161 LayerTreeHostCleared(); | 163 LayerTreeHostCleared(); |
162 EXPECT_EQ(0, GetUIResourceId(TEST_RESOURCE_TYPE)); | 164 EXPECT_EQ(0, GetUIResourceId(TEST_RESOURCE_TYPE)); |
163 LayerTreeHostReturned(); | 165 LayerTreeHostReturned(); |
164 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE)); | 166 EXPECT_NE(0, GetUIResourceId(TEST_RESOURCE_TYPE)); |
165 } | 167 } |
166 | 168 |
167 } // namespace content | 169 } // namespace content |
OLD | NEW |