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

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

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/media_stream_source_observer.h" 5 #include "content/renderer/media/media_stream_source_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/media/media_stream_source_extra_data.h" 8 #include "content/renderer/media/media_stream_source_extra_data.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 MediaStreamSourceObserver::MediaStreamSourceObserver( 12 MediaStreamSourceObserver::MediaStreamSourceObserver(
13 webrtc::MediaSourceInterface* webrtc_source, 13 webrtc::MediaSourceInterface* webrtc_source,
14 MediaStreamSourceExtraData* extra_data) 14 MediaStreamSourceExtraData* extra_data)
15 : state_(webrtc_source->state()), 15 : state_(webrtc_source->state()),
16 webrtc_source_(webrtc_source), 16 webrtc_source_(webrtc_source),
17 extra_data_(extra_data) { 17 extra_data_(extra_data) {
18 webrtc_source_->RegisterObserver(this); 18 webrtc_source_->RegisterObserver(this);
19 } 19 }
20 20
21 MediaStreamSourceObserver::~MediaStreamSourceObserver() { 21 MediaStreamSourceObserver::~MediaStreamSourceObserver() {
22 DCHECK(CalledOnValidThread()); 22 DCHECK(CalledOnValidThread());
23 if (webrtc_source_) 23 if (webrtc_source_.get())
24 webrtc_source_->UnregisterObserver(this); 24 webrtc_source_->UnregisterObserver(this);
25 } 25 }
26 26
27 void MediaStreamSourceObserver::OnChanged() { 27 void MediaStreamSourceObserver::OnChanged() {
28 DCHECK(CalledOnValidThread()); 28 DCHECK(CalledOnValidThread());
29 // There should be no more notification after kEnded. 29 // There should be no more notification after kEnded.
30 DCHECK(webrtc_source_ != NULL); 30 DCHECK(webrtc_source_.get() != NULL);
31 31
32 webrtc::MediaSourceInterface::SourceState state = webrtc_source_->state(); 32 webrtc::MediaSourceInterface::SourceState state = webrtc_source_->state();
33 if (state == state_) 33 if (state == state_)
34 return; 34 return;
35 state_ = state; 35 state_ = state;
36 WebKit::WebMediaStreamSource webkit_source(extra_data_->webkit_source()); 36 WebKit::WebMediaStreamSource webkit_source(extra_data_->webkit_source());
37 37
38 switch (state) { 38 switch (state) {
39 case webrtc::MediaSourceInterface::kInitializing: 39 case webrtc::MediaSourceInterface::kInitializing:
40 // Ignore the kInitializing state since there is no match in 40 // Ignore the kInitializing state since there is no match in
(...skipping 13 matching lines...) Expand all
54 webrtc_source_->UnregisterObserver(this); 54 webrtc_source_->UnregisterObserver(this);
55 webrtc_source_ = NULL; 55 webrtc_source_ = NULL;
56 break; 56 break;
57 default: 57 default:
58 NOTREACHED(); 58 NOTREACHED();
59 break; 59 break;
60 } 60 }
61 } 61 }
62 62
63 } // namespace content 63 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_source_extra_data.h ('k') | content/renderer/media/mock_media_stream_dependency_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698