OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef ImageQualityController_h | 31 #ifndef ImageQualityController_h |
32 #define ImageQualityController_h | 32 #define ImageQualityController_h |
33 | 33 |
34 #include "base/gtest_prod_util.h" | 34 #include "base/gtest_prod_util.h" |
35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
36 #include "platform/Timer.h" | 36 #include "platform/Timer.h" |
37 #include "platform/geometry/LayoutSize.h" | 37 #include "platform/geometry/LayoutSize.h" |
38 #include "platform/graphics/Image.h" | 38 #include "platform/graphics/Image.h" |
39 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
| 40 #include <memory> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 class LayoutObject; | 44 class LayoutObject; |
44 | 45 |
45 typedef HashMap<const void*, LayoutSize> LayerSizeMap; | 46 typedef HashMap<const void*, LayoutSize> LayerSizeMap; |
46 | 47 |
47 struct ObjectResizeInfo { | 48 struct ObjectResizeInfo { |
48 LayerSizeMap layerSizeMap; | 49 LayerSizeMap layerSizeMap; |
49 bool isResizing; | 50 bool isResizing; |
(...skipping 26 matching lines...) Expand all Loading... |
76 void objectDestroyed(const LayoutObject&); | 77 void objectDestroyed(const LayoutObject&); |
77 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } | 78 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } |
78 | 79 |
79 void highQualityRepaintTimerFired(Timer<ImageQualityController>*); | 80 void highQualityRepaintTimerFired(Timer<ImageQualityController>*); |
80 void restartTimer(double lastFrameTimeMonotonic); | 81 void restartTimer(double lastFrameTimeMonotonic); |
81 | 82 |
82 // Only for use in testing. | 83 // Only for use in testing. |
83 void setTimer(Timer<ImageQualityController>*); | 84 void setTimer(Timer<ImageQualityController>*); |
84 | 85 |
85 ObjectLayerSizeMap m_objectLayerSizeMap; | 86 ObjectLayerSizeMap m_objectLayerSizeMap; |
86 OwnPtr<Timer<ImageQualityController>> m_timer; | 87 std::unique_ptr<Timer<ImageQualityController>> m_timer; |
87 double m_frameTimeWhenTimerStarted; | 88 double m_frameTimeWhenTimerStarted; |
88 | 89 |
89 // For calling set(). | 90 // For calling set(). |
90 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle
r); | 91 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle
r); |
91 | 92 |
92 // For calling setTimer(), | 93 // For calling setTimer(), |
93 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi
zingImage); | 94 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi
zingImage); |
94 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, MediumQualityFilterForN
otAnimatedWhileAnotherAnimates); | 95 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, MediumQualityFilterForN
otAnimatedWhileAnotherAnimates); |
95 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim
erWhenPaintingAtTheSameSize); | 96 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim
erWhenPaintingAtTheSameSize); |
96 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontRestartTimerUnlessA
dvanced); | 97 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontRestartTimerUnlessA
dvanced); |
97 }; | 98 }; |
98 | 99 |
99 } // namespace blink | 100 } // namespace blink |
100 | 101 |
101 #endif | 102 #endif |
OLD | NEW |