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 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/layout/ImageQualityController.h" | 31 #include "core/layout/ImageQualityController.h" |
32 | 32 |
33 #include "core/frame/FrameView.h" | 33 #include "core/frame/FrameView.h" |
34 #include "core/frame/LocalFrame.h" | 34 #include "core/frame/LocalFrame.h" |
35 #include "core/frame/Settings.h" | 35 #include "core/frame/Settings.h" |
36 #include "core/page/ChromeClient.h" | 36 #include "core/page/ChromeClient.h" |
37 #include "core/page/Page.h" | 37 #include "core/page/Page.h" |
38 #include "wtf/PtrUtil.h" | |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 const double ImageQualityController::cLowQualityTimeThreshold = 0.500; // 500 ms | 41 const double ImageQualityController::cLowQualityTimeThreshold = 0.500; // 500 ms |
43 const double ImageQualityController::cTimerRestartThreshold = 0.250; // 250 ms | 42 const double ImageQualityController::cTimerRestartThreshold = 0.250; // 250 ms |
44 | 43 |
45 static ImageQualityController* gImageQualityController = nullptr; | 44 static ImageQualityController* gImageQualityController = nullptr; |
46 | 45 |
47 ImageQualityController* ImageQualityController::imageQualityController() | 46 ImageQualityController* ImageQualityController::imageQualityController() |
48 { | 47 { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return InterpolationDefault; | 85 return InterpolationDefault; |
87 } | 86 } |
88 | 87 |
89 ImageQualityController::~ImageQualityController() | 88 ImageQualityController::~ImageQualityController() |
90 { | 89 { |
91 // This will catch users of ImageQualityController that forget to call clean
Up. | 90 // This will catch users of ImageQualityController that forget to call clean
Up. |
92 ASSERT(!gImageQualityController || gImageQualityController->isEmpty()); | 91 ASSERT(!gImageQualityController || gImageQualityController->isEmpty()); |
93 } | 92 } |
94 | 93 |
95 ImageQualityController::ImageQualityController() | 94 ImageQualityController::ImageQualityController() |
96 : m_timer(wrapUnique(new Timer<ImageQualityController>(this, &ImageQualityCo
ntroller::highQualityRepaintTimerFired))) | 95 : m_timer(adoptPtr(new Timer<ImageQualityController>(this, &ImageQualityCont
roller::highQualityRepaintTimerFired))) |
97 , m_frameTimeWhenTimerStarted(0.0) | 96 , m_frameTimeWhenTimerStarted(0.0) |
98 { | 97 { |
99 } | 98 } |
100 | 99 |
101 void ImageQualityController::setTimer(Timer<ImageQualityController>* newTimer) | 100 void ImageQualityController::setTimer(Timer<ImageQualityController>* newTimer) |
102 { | 101 { |
103 m_timer = wrapUnique(newTimer); | 102 m_timer = adoptPtr(newTimer); |
104 } | 103 } |
105 | 104 |
106 void ImageQualityController::removeLayer(const LayoutObject& object, LayerSizeMa
p* innerMap, const void* layer) | 105 void ImageQualityController::removeLayer(const LayoutObject& object, LayerSizeMa
p* innerMap, const void* layer) |
107 { | 106 { |
108 if (innerMap) { | 107 if (innerMap) { |
109 innerMap->remove(layer); | 108 innerMap->remove(layer); |
110 if (innerMap->isEmpty()) | 109 if (innerMap->isEmpty()) |
111 objectDestroyed(object); | 110 objectDestroyed(object); |
112 } | 111 } |
113 } | 112 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 220 } |
222 // This object has been resized to two different sizes while the timer | 221 // 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 | 222 // is active, so draw at low quality, set the flag for animated resizes and |
224 // the object to the list for high quality redraw. | 223 // the object to the list for high quality redraw. |
225 set(object, innerMap, layer, layoutSize, true); | 224 set(object, innerMap, layer, layoutSize, true); |
226 restartTimer(lastFrameTimeMonotonic); | 225 restartTimer(lastFrameTimeMonotonic); |
227 return true; | 226 return true; |
228 } | 227 } |
229 | 228 |
230 } // namespace blink | 229 } // namespace blink |
OLD | NEW |