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/macros.h" | 10 #include "base/macros.h" |
11 #include "base/synchronization/lock.h" | |
11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
13 #include "media/base/media_log.h" | 14 #include "media/base/media_log.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class TickClock; | 17 class TickClock; |
17 } | 18 } |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 | 21 |
(...skipping 12 matching lines...) Expand all Loading... | |
33 void AddEvent(scoped_ptr<media::MediaLogEvent> event) override; | 34 void AddEvent(scoped_ptr<media::MediaLogEvent> event) override; |
34 | 35 |
35 // Will reset |last_ipc_send_time_| with the value of NowTicks(). | 36 // Will reset |last_ipc_send_time_| with the value of NowTicks(). |
36 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); | 37 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); |
37 void SetTaskRunnerForTesting( | 38 void SetTaskRunnerForTesting( |
38 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
39 | 40 |
40 private: | 41 private: |
41 ~RenderMediaLog() override; | 42 ~RenderMediaLog() override; |
42 | 43 |
43 // Add event on the |task_runner_|. | 44 // Posted as a delayed task on |task_runner_| to throttle ipc message |
44 void AddEventInternal(scoped_ptr<media::MediaLogEvent> event); | 45 // frequency. |
45 | |
46 // Posted as a delayed task to throttle ipc message frequency. | |
47 void SendQueuedMediaEvents(); | 46 void SendQueuedMediaEvents(); |
48 | 47 |
48 mutable base::Lock lock_; | |
xhwang
2016/04/01 05:42:55
Could you please be more specific about what this
wolenetz
2016/04/04 18:30:32
Done.
| |
49 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 49 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
50 scoped_ptr<base::TickClock> tick_clock_; | 50 scoped_ptr<base::TickClock> tick_clock_; |
51 base::TimeTicks last_ipc_send_time_; | 51 base::TimeTicks last_ipc_send_time_; |
52 std::vector<media::MediaLogEvent> queued_media_events_; | 52 std::vector<media::MediaLogEvent> queued_media_events_; |
53 | 53 |
54 // For enforcing max 1 pending send. | |
55 bool ipc_send_pending_; | |
56 | |
54 // Limits the number buffered extents changed events we send over IPC to one. | 57 // Limits the number buffered extents changed events we send over IPC to one. |
55 scoped_ptr<media::MediaLogEvent> last_buffered_extents_changed_event_; | 58 scoped_ptr<media::MediaLogEvent> last_buffered_extents_changed_event_; |
56 | 59 |
57 DISALLOW_COPY_AND_ASSIGN(RenderMediaLog); | 60 DISALLOW_COPY_AND_ASSIGN(RenderMediaLog); |
58 }; | 61 }; |
59 | 62 |
60 } // namespace content | 63 } // namespace content |
61 | 64 |
62 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ | 65 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ |
OLD | NEW |