| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 m_frameTimeWhenTimerStarted(0.0) {} | 103 m_frameTimeWhenTimerStarted(0.0) {} |
| 104 | 104 |
| 105 void ImageQualityController::setTimer(std::unique_ptr<TimerBase> newTimer) { | 105 void ImageQualityController::setTimer(std::unique_ptr<TimerBase> newTimer) { |
| 106 m_timer = std::move(newTimer); | 106 m_timer = std::move(newTimer); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ImageQualityController::removeLayer(const LayoutObject& object, | 109 void ImageQualityController::removeLayer(const LayoutObject& object, |
| 110 LayerSizeMap* innerMap, | 110 LayerSizeMap* innerMap, |
| 111 const void* layer) { | 111 const void* layer) { |
| 112 if (innerMap) { | 112 if (innerMap) { |
| 113 innerMap->remove(layer); | 113 innerMap->erase(layer); |
| 114 if (innerMap->isEmpty()) | 114 if (innerMap->isEmpty()) |
| 115 objectDestroyed(object); | 115 objectDestroyed(object); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 void ImageQualityController::set(const LayoutObject& object, | 119 void ImageQualityController::set(const LayoutObject& object, |
| 120 LayerSizeMap* innerMap, | 120 LayerSizeMap* innerMap, |
| 121 const void* layer, | 121 const void* layer, |
| 122 const LayoutSize& size, | 122 const LayoutSize& size, |
| 123 bool isResizing) { | 123 bool isResizing) { |
| 124 if (innerMap) { | 124 if (innerMap) { |
| 125 innerMap->set(layer, size); | 125 innerMap->set(layer, size); |
| 126 m_objectLayerSizeMap.find(&object)->value.isResizing = isResizing; | 126 m_objectLayerSizeMap.find(&object)->value.isResizing = isResizing; |
| 127 } else { | 127 } else { |
| 128 ObjectResizeInfo newResizeInfo; | 128 ObjectResizeInfo newResizeInfo; |
| 129 newResizeInfo.layerSizeMap.set(layer, size); | 129 newResizeInfo.layerSizeMap.set(layer, size); |
| 130 newResizeInfo.isResizing = isResizing; | 130 newResizeInfo.isResizing = isResizing; |
| 131 m_objectLayerSizeMap.set(&object, newResizeInfo); | 131 m_objectLayerSizeMap.set(&object, newResizeInfo); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void ImageQualityController::objectDestroyed(const LayoutObject& object) { | 135 void ImageQualityController::objectDestroyed(const LayoutObject& object) { |
| 136 m_objectLayerSizeMap.remove(&object); | 136 m_objectLayerSizeMap.erase(&object); |
| 137 if (m_objectLayerSizeMap.isEmpty()) { | 137 if (m_objectLayerSizeMap.isEmpty()) { |
| 138 m_timer->stop(); | 138 m_timer->stop(); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ImageQualityController::highQualityRepaintTimerFired(TimerBase*) { | 142 void ImageQualityController::highQualityRepaintTimerFired(TimerBase*) { |
| 143 for (auto& i : m_objectLayerSizeMap) { | 143 for (auto& i : m_objectLayerSizeMap) { |
| 144 // Only invalidate the object if it is animating. | 144 // Only invalidate the object if it is animating. |
| 145 if (!i.value.isResizing) | 145 if (!i.value.isResizing) |
| 146 continue; | 146 continue; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 235 } |
| 236 // This object has been resized to two different sizes while the timer | 236 // This object has been resized to two different sizes while the timer |
| 237 // is active, so draw at low quality, set the flag for animated resizes and | 237 // is active, so draw at low quality, set the flag for animated resizes and |
| 238 // the object to the list for high quality redraw. | 238 // the object to the list for high quality redraw. |
| 239 set(object, innerMap, layer, layoutSize, true); | 239 set(object, innerMap, layer, layoutSize, true); |
| 240 restartTimer(lastFrameTimeMonotonic); | 240 restartTimer(lastFrameTimeMonotonic); |
| 241 return true; | 241 return true; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace blink | 244 } // namespace blink |
| OLD | NEW |