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

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

Issue 877273002: Add media log messages to the main log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use generic JSON serialization instead of handling each event type Created 5 years, 9 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
« no previous file with comments | « no previous file | media/base/media_log.h » ('j') | media/base/media_log.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/renderer/media/render_media_log.h" 5 #include "content/renderer/media/render_media_log.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
11 #include "content/public/renderer/render_thread.h" 11 #include "content/public/renderer/render_thread.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 RenderMediaLog::RenderMediaLog() 15 RenderMediaLog::RenderMediaLog()
16 : render_loop_(base::MessageLoopProxy::current()), 16 : render_loop_(base::MessageLoopProxy::current()),
17 tick_clock_(new base::DefaultTickClock()), 17 tick_clock_(new base::DefaultTickClock()),
18 last_ipc_send_time_(tick_clock_->NowTicks()) { 18 last_ipc_send_time_(tick_clock_->NowTicks()) {
19 DCHECK(RenderThread::Get()) << 19 DCHECK(RenderThread::Get()) <<
20 "RenderMediaLog must be constructed on the render thread"; 20 "RenderMediaLog must be constructed on the render thread";
21 } 21 }
22 22
23 void RenderMediaLog::AddEvent(scoped_ptr<media::MediaLogEvent> event) { 23 void RenderMediaLog::AddEvent(scoped_ptr<media::MediaLogEvent> event) {
24 if (!RenderThread::Get()) { 24 if (!RenderThread::Get()) {
25 render_loop_->PostTask(FROM_HERE, base::Bind( 25 render_loop_->PostTask(FROM_HERE, base::Bind(
26 &RenderMediaLog::AddEvent, this, base::Passed(&event))); 26 &RenderMediaLog::AddEvent, this, base::Passed(&event)));
27 return; 27 return;
28 } 28 }
29 29
30 if (event->type == media::MediaLogEvent::PIPELINE_ERROR) {
31 LOG(ERROR) << "MediaEvent: "
32 << media::MediaLog::MediaEventToLogString(*event.get());
33 } else if (event->type != media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED &&
34 event->type != media::MediaLogEvent::PROPERTY_CHANGE &&
35 event->type != media::MediaLogEvent::NETWORK_ACTIVITY_SET) {
36 DVLOG(1) << "MediaEvent: "
37 << media::MediaLog::MediaEventToLogString(*event.get());
38 }
39
30 // Keep track of the latest buffered extents properties to avoid sending 40 // Keep track of the latest buffered extents properties to avoid sending
31 // thousands of events over IPC. See http://crbug.com/352585 for details. 41 // thousands of events over IPC. See http://crbug.com/352585 for details.
32 // 42 //
33 // TODO(scherkus): We should overhaul MediaLog entirely to have clearer 43 // TODO(scherkus): We should overhaul MediaLog entirely to have clearer
34 // separation of properties vs. events. 44 // separation of properties vs. events.
35 if (event->type == media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED) 45 if (event->type == media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED)
36 last_buffered_extents_changed_event_.swap(event); 46 last_buffered_extents_changed_event_.swap(event);
37 else 47 else
38 queued_media_events_.push_back(*event); 48 queued_media_events_.push_back(*event);
39 49
(...skipping 17 matching lines...) Expand all
57 67
58 RenderMediaLog::~RenderMediaLog() {} 68 RenderMediaLog::~RenderMediaLog() {}
59 69
60 void RenderMediaLog::SetTickClockForTesting( 70 void RenderMediaLog::SetTickClockForTesting(
61 scoped_ptr<base::TickClock> tick_clock) { 71 scoped_ptr<base::TickClock> tick_clock) {
62 tick_clock_.swap(tick_clock); 72 tick_clock_.swap(tick_clock);
63 last_ipc_send_time_ = tick_clock_->NowTicks(); 73 last_ipc_send_time_ = tick_clock_->NowTicks();
64 } 74 }
65 75
66 } // namespace content 76 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/base/media_log.h » ('j') | media/base/media_log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698