| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 public: | 57 public: |
| 58 ~ImageQualityController(); | 58 ~ImageQualityController(); |
| 59 | 59 |
| 60 static ImageQualityController* imageQualityController(); | 60 static ImageQualityController* imageQualityController(); |
| 61 | 61 |
| 62 static void remove(LayoutObject&); | 62 static void remove(LayoutObject&); |
| 63 | 63 |
| 64 InterpolationQuality chooseInterpolationQuality(const LayoutObject&, Image*,
const void* layer, const LayoutSize&); | 64 InterpolationQuality chooseInterpolationQuality(const LayoutObject&, Image*,
const void* layer, const LayoutSize&); |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 static const double cLowQualityTimeThreshold; |
| 68 static const double cTimerRestartThreshold; |
| 69 |
| 67 ImageQualityController(); | 70 ImageQualityController(); |
| 68 | 71 |
| 69 static bool has(const LayoutObject&); | 72 static bool has(const LayoutObject&); |
| 70 void set(const LayoutObject&, LayerSizeMap* innerMap, const void* layer, con
st LayoutSize&, bool isResizing); | 73 void set(const LayoutObject&, LayerSizeMap* innerMap, const void* layer, con
st LayoutSize&, bool isResizing); |
| 71 | 74 |
| 72 bool shouldPaintAtLowQuality(const LayoutObject&, Image*, const void* layer,
const LayoutSize&); | 75 bool shouldPaintAtLowQuality(const LayoutObject&, Image*, const void* layer,
const LayoutSize&, double lastFrameTimeMonotonic); |
| 73 void removeLayer(const LayoutObject&, LayerSizeMap* innerMap, const void* la
yer); | 76 void removeLayer(const LayoutObject&, LayerSizeMap* innerMap, const void* la
yer); |
| 74 void objectDestroyed(const LayoutObject&); | 77 void objectDestroyed(const LayoutObject&); |
| 75 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } | 78 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } |
| 76 | 79 |
| 77 void highQualityRepaintTimerFired(Timer<ImageQualityController>*); | 80 void highQualityRepaintTimerFired(Timer<ImageQualityController>*); |
| 78 void restartTimer(); | 81 void restartTimer(double lastFrameTimeMonotonic); |
| 79 | 82 |
| 80 // Only for use in testing. | 83 // Only for use in testing. |
| 81 void setTimer(Timer<ImageQualityController>*); | 84 void setTimer(Timer<ImageQualityController>*); |
| 82 | 85 |
| 83 ObjectLayerSizeMap m_objectLayerSizeMap; | 86 ObjectLayerSizeMap m_objectLayerSizeMap; |
| 84 OwnPtr<Timer<ImageQualityController>> m_timer; | 87 OwnPtr<Timer<ImageQualityController>> m_timer; |
| 88 double m_frameTimeWhenTimerStarted; |
| 85 | 89 |
| 86 // For calling set(). | 90 // For calling set(). |
| 87 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle
r); | 91 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle
r); |
| 88 | 92 |
| 89 // For calling setTimer(), | 93 // For calling setTimer(), |
| 90 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForLive
Resize); | 94 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForLive
Resize); |
| 91 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi
zingImage); | 95 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi
zingImage); |
| 92 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, MediumQualityFilterForN
otAnimatedWhileAnotherAnimates); | 96 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, MediumQualityFilterForN
otAnimatedWhileAnotherAnimates); |
| 93 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim
erWhenPaintingAtTheSameSize); | 97 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim
erWhenPaintingAtTheSameSize); |
| 98 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontRestartTimerUnlessA
dvanced); |
| 94 }; | 99 }; |
| 95 | 100 |
| 96 } // namespace blink | 101 } // namespace blink |
| 97 | 102 |
| 98 #endif | 103 #endif |
| OLD | NEW |