OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDER_MEDIA_LOG_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ |
6 #define CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "media/base/media_log.h" | 12 #include "media/base/media_log.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class MessageLoopProxy; | 15 class MessageLoopProxy; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 // RenderMediaLog is an implementation of MediaLog that forwards events to the | 20 // RenderMediaLog is an implementation of MediaLog that forwards events to the |
21 // browser process, throttling as necessary. | 21 // browser process, throttling as necessary. |
22 // | 22 // |
23 // To minimize the number of events sent over the wire, only the latest event | 23 // To minimize the number of events sent over the wire, only the latest event |
24 // added is sent for high frequency events (e.g., BUFFERED_EXTENTS_CHANGED). | 24 // added is sent for high frequency events (e.g., BUFFERED_EXTENTS_CHANGED). |
25 class CONTENT_EXPORT RenderMediaLog : public media::MediaLog { | 25 class CONTENT_EXPORT RenderMediaLog : public media::MediaLog { |
26 public: | 26 public: |
27 RenderMediaLog(); | 27 RenderMediaLog(); |
28 | 28 |
29 // MediaLog implementation. | 29 // MediaLog implementation. |
30 virtual void AddEvent(scoped_ptr<media::MediaLogEvent> event) OVERRIDE; | 30 virtual void AddEvent(scoped_ptr<media::MediaLogEvent> event) override; |
31 | 31 |
32 // Will reset |last_ipc_send_time_| with the value of NowTicks(). | 32 // Will reset |last_ipc_send_time_| with the value of NowTicks(). |
33 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); | 33 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); |
34 | 34 |
35 private: | 35 private: |
36 virtual ~RenderMediaLog(); | 36 virtual ~RenderMediaLog(); |
37 | 37 |
38 scoped_refptr<base::MessageLoopProxy> render_loop_; | 38 scoped_refptr<base::MessageLoopProxy> render_loop_; |
39 scoped_ptr<base::TickClock> tick_clock_; | 39 scoped_ptr<base::TickClock> tick_clock_; |
40 base::TimeTicks last_ipc_send_time_; | 40 base::TimeTicks last_ipc_send_time_; |
41 std::vector<media::MediaLogEvent> queued_media_events_; | 41 std::vector<media::MediaLogEvent> queued_media_events_; |
42 | 42 |
43 // Limits the number buffered extents changed events we send over IPC to one. | 43 // Limits the number buffered extents changed events we send over IPC to one. |
44 scoped_ptr<media::MediaLogEvent> last_buffered_extents_changed_event_; | 44 scoped_ptr<media::MediaLogEvent> last_buffered_extents_changed_event_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(RenderMediaLog); | 46 DISALLOW_COPY_AND_ASSIGN(RenderMediaLog); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace content | 49 } // namespace content |
50 | 50 |
51 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ | 51 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ |
OLD | NEW |