Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: third_party/WebKit/Source/core/layout/ImageQualityController.h

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ImageQualityController(); 70 ImageQualityController();
71 71
72 static bool has(const LayoutObject&); 72 static bool has(const LayoutObject&);
73 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);
74 74
75 bool shouldPaintAtLowQuality(const LayoutObject&, Image*, const void* layer, const LayoutSize&, double lastFrameTimeMonotonic); 75 bool shouldPaintAtLowQuality(const LayoutObject&, Image*, const void* layer, const LayoutSize&, double lastFrameTimeMonotonic);
76 void removeLayer(const LayoutObject&, LayerSizeMap* innerMap, const void* la yer); 76 void removeLayer(const LayoutObject&, LayerSizeMap* innerMap, const void* la yer);
77 void objectDestroyed(const LayoutObject&); 77 void objectDestroyed(const LayoutObject&);
78 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } 78 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); }
79 79
80 void highQualityRepaintTimerFired(Timer<ImageQualityController>*); 80 void highQualityRepaintTimerFired(TimerBase*);
81 void restartTimer(double lastFrameTimeMonotonic); 81 void restartTimer(double lastFrameTimeMonotonic);
82 82
83 // Only for use in testing. 83 // Only for use in testing.
84 void setTimer(Timer<ImageQualityController>*); 84 void setTimer(TaskRunnerTimer<ImageQualityController>*);
dcheng 2016/07/28 13:09:51 Do we have a better way to mock out timers for tes
haraken 2016/07/28 14:44:46 Yeah, this looks ugly. Can we make MockTimer inher
dcheng 2016/07/29 02:23:18 Hmm, the more I think about, I think that Timer sh
85 85
86 ObjectLayerSizeMap m_objectLayerSizeMap; 86 ObjectLayerSizeMap m_objectLayerSizeMap;
87 std::unique_ptr<Timer<ImageQualityController>> m_timer; 87 std::unique_ptr<TaskRunnerTimer<ImageQualityController>> m_timer;
88 double m_frameTimeWhenTimerStarted; 88 double m_frameTimeWhenTimerStarted;
89 89
90 // For calling set(). 90 // For calling set().
91 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle r); 91 FRIEND_TEST_ALL_PREFIXES(LayoutPartTest, DestroyUpdatesImageQualityControlle r);
92 92
93 // For calling setTimer(), 93 // For calling setTimer(),
94 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi zingImage); 94 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, LowQualityFilterForResi zingImage);
95 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, MediumQualityFilterForN otAnimatedWhileAnotherAnimates); 95 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, MediumQualityFilterForN otAnimatedWhileAnotherAnimates);
96 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim erWhenPaintingAtTheSameSize); 96 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontKickTheAnimationTim erWhenPaintingAtTheSameSize);
97 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontRestartTimerUnlessA dvanced); 97 FRIEND_TEST_ALL_PREFIXES(ImageQualityControllerTest, DontRestartTimerUnlessA dvanced);
98 }; 98 };
99 99
100 } // namespace blink 100 } // namespace blink
101 101
102 #endif 102 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698