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

Side by Side Diff: chrome/browser/media/media_internals.cc

Issue 7480032: Plumb media data from renderers up to MediaInternals in the browser process. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Much cleanup and making MediaLog thread safe. Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/media/media_internals.h" 5 #include "chrome/browser/media/media_internals.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/media/media_internals_observer.h" 10 #include "chrome/browser/media/media_internals_observer.h"
(...skipping 28 matching lines...) Expand all
39 "status", Value::CreateStringValue(status)); 39 "status", Value::CreateStringValue(status));
40 } 40 }
41 41
42 void MediaInternals::OnSetAudioStreamVolume( 42 void MediaInternals::OnSetAudioStreamVolume(
43 void* host, int stream_id, double volume) { 43 void* host, int stream_id, double volume) {
44 DCHECK(CalledOnValidThread()); 44 DCHECK(CalledOnValidThread());
45 UpdateAudioStream(host, stream_id, 45 UpdateAudioStream(host, stream_id,
46 "volume", Value::CreateDoubleValue(volume)); 46 "volume", Value::CreateDoubleValue(volume));
47 } 47 }
48 48
49 void MediaInternals::OnMediaEvent(const media::MediaLog::Event& event) {
50 DCHECK(CalledOnValidThread());
51 // TODO(scottfr): Handle |event|. Record status information in data_ and pass
52 // |event| along to observers.
53 }
54
49 void MediaInternals::AddObserver(MediaInternalsObserver* observer) { 55 void MediaInternals::AddObserver(MediaInternalsObserver* observer) {
50 DCHECK(CalledOnValidThread()); 56 DCHECK(CalledOnValidThread());
51 observers_.AddObserver(observer); 57 observers_.AddObserver(observer);
52 } 58 }
53 59
54 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) { 60 void MediaInternals::RemoveObserver(MediaInternalsObserver* observer) {
55 DCHECK(CalledOnValidThread()); 61 DCHECK(CalledOnValidThread());
56 observers_.RemoveObserver(observer); 62 observers_.RemoveObserver(observer);
57 } 63 }
58 64
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 97
92 void MediaInternals::SendUpdate(const std::string& function, Value* value) { 98 void MediaInternals::SendUpdate(const std::string& function, Value* value) {
93 // Only bother serializing the update to JSON if someone is watching. 99 // Only bother serializing the update to JSON if someone is watching.
94 if (observers_.size()) { 100 if (observers_.size()) {
95 std::vector<const Value*> args; 101 std::vector<const Value*> args;
96 args.push_back(value); 102 args.push_back(value);
97 string16 update = WebUI::GetJavascriptCall(function, args); 103 string16 update = WebUI::GetJavascriptCall(function, args);
98 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update)); 104 FOR_EACH_OBSERVER(MediaInternalsObserver, observers_, OnUpdate(update));
99 } 105 }
100 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698