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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // This will catch users of ImageQualityController that forget to call clean
Up. | 91 // This will catch users of ImageQualityController that forget to call clean
Up. |
92 ASSERT(!gImageQualityController || gImageQualityController->isEmpty()); | 92 ASSERT(!gImageQualityController || gImageQualityController->isEmpty()); |
93 } | 93 } |
94 | 94 |
95 ImageQualityController::ImageQualityController() | 95 ImageQualityController::ImageQualityController() |
96 : m_timer(wrapUnique(new Timer<ImageQualityController>(this, &ImageQualityCo
ntroller::highQualityRepaintTimerFired))) | 96 : m_timer(wrapUnique(new Timer<ImageQualityController>(this, &ImageQualityCo
ntroller::highQualityRepaintTimerFired))) |
97 , m_frameTimeWhenTimerStarted(0.0) | 97 , m_frameTimeWhenTimerStarted(0.0) |
98 { | 98 { |
99 } | 99 } |
100 | 100 |
101 void ImageQualityController::setTimer(Timer<ImageQualityController>* newTimer) | 101 void ImageQualityController::setTimer(TaskRunnerTimer<ImageQualityController>* n
ewTimer) |
102 { | 102 { |
103 m_timer = wrapUnique(newTimer); | 103 m_timer = wrapUnique(newTimer); |
104 } | 104 } |
105 | 105 |
106 void ImageQualityController::removeLayer(const LayoutObject& object, LayerSizeMa
p* innerMap, const void* layer) | 106 void ImageQualityController::removeLayer(const LayoutObject& object, LayerSizeMa
p* innerMap, const void* layer) |
107 { | 107 { |
108 if (innerMap) { | 108 if (innerMap) { |
109 innerMap->remove(layer); | 109 innerMap->remove(layer); |
110 if (innerMap->isEmpty()) | 110 if (innerMap->isEmpty()) |
111 objectDestroyed(object); | 111 objectDestroyed(object); |
(...skipping 14 matching lines...) Expand all Loading... |
126 } | 126 } |
127 | 127 |
128 void ImageQualityController::objectDestroyed(const LayoutObject& object) | 128 void ImageQualityController::objectDestroyed(const LayoutObject& object) |
129 { | 129 { |
130 m_objectLayerSizeMap.remove(&object); | 130 m_objectLayerSizeMap.remove(&object); |
131 if (m_objectLayerSizeMap.isEmpty()) { | 131 if (m_objectLayerSizeMap.isEmpty()) { |
132 m_timer->stop(); | 132 m_timer->stop(); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 void ImageQualityController::highQualityRepaintTimerFired(Timer<ImageQualityCont
roller>*) | 136 void ImageQualityController::highQualityRepaintTimerFired(TimerBase*) |
137 { | 137 { |
138 for (auto& i : m_objectLayerSizeMap) { | 138 for (auto& i : m_objectLayerSizeMap) { |
139 // Only invalidate the object if it is animating. | 139 // Only invalidate the object if it is animating. |
140 if (!i.value.isResizing) | 140 if (!i.value.isResizing) |
141 continue; | 141 continue; |
142 | 142 |
143 // TODO(wangxianzhu): Use LayoutObject::getMutableForPainting(). | 143 // TODO(wangxianzhu): Use LayoutObject::getMutableForPainting(). |
144 const_cast<LayoutObject*>(i.key)->setShouldDoFullPaintInvalidation(); | 144 const_cast<LayoutObject*>(i.key)->setShouldDoFullPaintInvalidation(); |
145 i.value.isResizing = false; | 145 i.value.isResizing = false; |
146 } | 146 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 // This object has been resized to two different sizes while the timer | 222 // This object has been resized to two different sizes while the timer |
223 // is active, so draw at low quality, set the flag for animated resizes and | 223 // is active, so draw at low quality, set the flag for animated resizes and |
224 // the object to the list for high quality redraw. | 224 // the object to the list for high quality redraw. |
225 set(object, innerMap, layer, layoutSize, true); | 225 set(object, innerMap, layer, layoutSize, true); |
226 restartTimer(lastFrameTimeMonotonic); | 226 restartTimer(lastFrameTimeMonotonic); |
227 return true; | 227 return true; |
228 } | 228 } |
229 | 229 |
230 } // namespace blink | 230 } // namespace blink |
OLD | NEW |