| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/containers/hash_tables.h" | 7 #include <unordered_map> |
| 8 |
| 8 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 9 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
| 10 #include "cc/layers/append_quads_data.h" | 11 #include "cc/layers/append_quads_data.h" |
| 11 #include "cc/layers/painted_scrollbar_layer.h" | 12 #include "cc/layers/painted_scrollbar_layer.h" |
| 12 #include "cc/layers/painted_scrollbar_layer_impl.h" | 13 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 13 #include "cc/layers/scrollbar_layer_interface.h" | 14 #include "cc/layers/scrollbar_layer_interface.h" |
| 14 #include "cc/layers/solid_color_scrollbar_layer.h" | 15 #include "cc/layers/solid_color_scrollbar_layer.h" |
| 15 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 16 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 16 #include "cc/quads/solid_color_draw_quad.h" | 17 #include "cc/quads/solid_color_draw_quad.h" |
| 17 #include "cc/test/fake_impl_task_runner_provider.h" | 18 #include "cc/test/fake_impl_task_runner_provider.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 103 } |
| 103 | 104 |
| 104 UIResourceBitmap* ui_resource_bitmap(UIResourceId id) { | 105 UIResourceBitmap* ui_resource_bitmap(UIResourceId id) { |
| 105 UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id); | 106 UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id); |
| 106 if (iter != ui_resource_bitmap_map_.end()) | 107 if (iter != ui_resource_bitmap_map_.end()) |
| 107 return &iter->second; | 108 return &iter->second; |
| 108 return nullptr; | 109 return nullptr; |
| 109 } | 110 } |
| 110 | 111 |
| 111 private: | 112 private: |
| 112 using UIResourceBitmapMap = base::hash_map<UIResourceId, UIResourceBitmap>; | 113 using UIResourceBitmapMap = |
| 114 std::unordered_map<UIResourceId, UIResourceBitmap>; |
| 113 UIResourceBitmapMap ui_resource_bitmap_map_; | 115 UIResourceBitmapMap ui_resource_bitmap_map_; |
| 114 | 116 |
| 115 int next_id_; | 117 int next_id_; |
| 116 int total_ui_resource_created_; | 118 int total_ui_resource_created_; |
| 117 int total_ui_resource_deleted_; | 119 int total_ui_resource_deleted_; |
| 118 }; | 120 }; |
| 119 | 121 |
| 120 class ScrollbarLayerTest : public testing::Test { | 122 class ScrollbarLayerTest : public testing::Test { |
| 121 public: | 123 public: |
| 122 ScrollbarLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) { | 124 ScrollbarLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) { |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1009 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
| 1008 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1010 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
| 1009 | 1011 |
| 1010 // Horizontal Scrollbars. | 1012 // Horizontal Scrollbars. |
| 1011 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1013 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
| 1012 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1014 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
| 1013 } | 1015 } |
| 1014 | 1016 |
| 1015 } // namespace | 1017 } // namespace |
| 1016 } // namespace cc | 1018 } // namespace cc |
| OLD | NEW |