OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ |
6 #define CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void RemoveIdleDelegate(int delegate_id); | 84 void RemoveIdleDelegate(int delegate_id); |
85 | 85 |
86 // Runs periodically to suspend idle delegates in |idle_delegate_map_| which | 86 // Runs periodically to suspend idle delegates in |idle_delegate_map_| which |
87 // have been idle for longer than |timeout|. | 87 // have been idle for longer than |timeout|. |
88 void CleanupIdleDelegates(base::TimeDelta timeout); | 88 void CleanupIdleDelegates(base::TimeDelta timeout); |
89 | 89 |
90 // Setter for |is_playing_background_video_| that updates the metrics. | 90 // Setter for |is_playing_background_video_| that updates the metrics. |
91 void SetIsPlayingBackgroundVideo(bool is_playing); | 91 void SetIsPlayingBackgroundVideo(bool is_playing); |
92 | 92 |
93 bool has_played_media_ = false; | 93 bool has_played_media_ = false; |
94 IDMap<Observer> id_map_; | 94 IDMap<Observer*> id_map_; |
95 | 95 |
96 // Tracks which delegates have entered an idle state. After some period of | 96 // Tracks which delegates have entered an idle state. After some period of |
97 // inactivity these players will be suspended to release unused resources. | 97 // inactivity these players will be suspended to release unused resources. |
98 bool idle_cleanup_running_ = false; | 98 bool idle_cleanup_running_ = false; |
99 std::map<int, base::TimeTicks> idle_delegate_map_; | 99 std::map<int, base::TimeTicks> idle_delegate_map_; |
100 base::Timer idle_cleanup_timer_; | 100 base::Timer idle_cleanup_timer_; |
101 | 101 |
102 // Amount of time allowed to elapse after a delegate enters the paused before | 102 // Amount of time allowed to elapse after a delegate enters the paused before |
103 // the delegate is suspended. | 103 // the delegate is suspended. |
104 base::TimeDelta idle_timeout_; | 104 base::TimeDelta idle_timeout_; |
(...skipping 25 matching lines...) Expand all Loading... |
130 // Determined at construction time based on system information; determines | 130 // Determined at construction time based on system information; determines |
131 // when the idle cleanup timer should be fired more aggressively. | 131 // when the idle cleanup timer should be fired more aggressively. |
132 bool is_low_end_device_; | 132 bool is_low_end_device_; |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(RendererWebMediaPlayerDelegate); | 134 DISALLOW_COPY_AND_ASSIGN(RendererWebMediaPlayerDelegate); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace media | 137 } // namespace media |
138 | 138 |
139 #endif // CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ | 139 #endif // CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ |
OLD | NEW |