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