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

Side by Side Diff: content/renderer/media/render_media_log.h

Issue 2660003003: Add MediaError.message (Closed)
Patch Set: Address dalecurtis@'s comment: undef STRINGIFY_STATUS_CASE Created 3 years, 8 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 // 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 21 matching lines...) Expand all
32 // added is sent for high frequency events (e.g., BUFFERED_EXTENTS_CHANGED). 32 // added is sent for high frequency events (e.g., BUFFERED_EXTENTS_CHANGED).
33 // 33 //
34 // It must be constructed on the render thread. 34 // It must be constructed on the render thread.
35 class CONTENT_EXPORT RenderMediaLog : public media::MediaLog { 35 class CONTENT_EXPORT RenderMediaLog : public media::MediaLog {
36 public: 36 public:
37 explicit RenderMediaLog(const GURL& security_origin); 37 explicit RenderMediaLog(const GURL& security_origin);
38 ~RenderMediaLog() override; 38 ~RenderMediaLog() override;
39 39
40 // MediaLog implementation. 40 // MediaLog implementation.
41 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override; 41 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override;
42 std::string GetLastErrorMessage() override; 42 std::string GetErrorMessage() override;
43 void RecordRapporWithSecurityOrigin(const std::string& metric) override; 43 void RecordRapporWithSecurityOrigin(const std::string& metric) override;
44 44
45 // Will reset |last_ipc_send_time_| with the value of NowTicks(). 45 // Will reset |last_ipc_send_time_| with the value of NowTicks().
46 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); 46 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
47 void SetTaskRunnerForTesting( 47 void SetTaskRunnerForTesting(
48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
49 49
50 private: 50 private:
51 // Posted as a delayed task on |task_runner_| to throttle ipc message 51 // Posted as a delayed task on |task_runner_| to throttle ipc message
52 // frequency. 52 // frequency.
53 void SendQueuedMediaEvents(); 53 void SendQueuedMediaEvents();
54 54
55 // Security origin of the current frame. 55 // Security origin of the current frame.
56 const GURL security_origin_; 56 const GURL security_origin_;
57 57
58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
59 59
60 // |lock_| protects access to all of the following member variables. It 60 // |lock_| protects access to all of the following member variables. It
61 // allows any render process thread to AddEvent(), while preserving their 61 // allows any render process thread to AddEvent(), while preserving their
62 // sequence for throttled send on |task_runner_| and coherent retrieval by 62 // sequence for throttled send on |task_runner_| and coherent retrieval by
63 // GetLastErrorMessage(). 63 // GetErrorMessage().
64 mutable base::Lock lock_; 64 mutable base::Lock lock_;
65 std::unique_ptr<base::TickClock> tick_clock_; 65 std::unique_ptr<base::TickClock> tick_clock_;
66 base::TimeTicks last_ipc_send_time_; 66 base::TimeTicks last_ipc_send_time_;
67 std::vector<media::MediaLogEvent> queued_media_events_; 67 std::vector<media::MediaLogEvent> queued_media_events_;
68 68
69 // For enforcing max 1 pending send. 69 // For enforcing max 1 pending send.
70 bool ipc_send_pending_; 70 bool ipc_send_pending_;
71 71
72 // Limits the number of events we send over IPC to one. 72 // Limits the number of events we send over IPC to one.
73 std::unique_ptr<media::MediaLogEvent> last_buffered_extents_changed_event_; 73 std::unique_ptr<media::MediaLogEvent> last_buffered_extents_changed_event_;
74 std::unique_ptr<media::MediaLogEvent> last_duration_changed_event_; 74 std::unique_ptr<media::MediaLogEvent> last_duration_changed_event_;
75 75
76 // Holds a copy of the most recent MEDIA_ERROR_LOG_ENTRY, if any. 76 // Holds the earliest MEDIA_ERROR_LOG_ENTRY event added to this log. This is
77 std::unique_ptr<media::MediaLogEvent> last_media_error_log_entry_; 77 // most likely to contain the most specific information available describing
78 // any eventual fatal error.
79 // TODO(wolenetz): Introduce a reset method to clear this in cases like
80 // non-fatal error recovery like decoder fallback.
81 std::unique_ptr<media::MediaLogEvent> cached_media_error_for_message_;
78 82
79 // Holds a copy of the most recent PIPELINE_ERROR, if any. 83 // Holds a copy of the most recent PIPELINE_ERROR, if any.
80 std::unique_ptr<media::MediaLogEvent> last_pipeline_error_; 84 std::unique_ptr<media::MediaLogEvent> last_pipeline_error_;
81 85
82 base::WeakPtr<RenderMediaLog> weak_this_; 86 base::WeakPtr<RenderMediaLog> weak_this_;
83 base::WeakPtrFactory<RenderMediaLog> weak_factory_; 87 base::WeakPtrFactory<RenderMediaLog> weak_factory_;
84 88
85 DISALLOW_COPY_AND_ASSIGN(RenderMediaLog); 89 DISALLOW_COPY_AND_ASSIGN(RenderMediaLog);
86 }; 90 };
87 91
88 } // namespace content 92 } // namespace content
89 93
90 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_ 94 #endif // CONTENT_RENDERER_MEDIA_RENDER_MEDIA_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698