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

Side by Side Diff: media/cast/cast_environment.cc

Issue 145443005: Fixes for memory and threading issues in cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 6 years, 11 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
« no previous file with comments | « media/cast/cast_environment.h ('k') | media/cast/rtcp/rtcp_receiver_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "media/cast/cast_environment.h" 5 #include "media/cast/cast_environment.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 using base::TaskRunner; 11 using base::TaskRunner;
12 12
13 namespace { 13 namespace {
14 14
15 void DeleteLoggingOnMainThread(scoped_ptr<media::cast::LoggingImpl> logging) { 15 void DeleteLoggingOnMainThread(scoped_ptr<media::cast::LoggingImpl> logging) {
16 logging.reset(); 16 logging.reset();
17 } 17 }
18 18
19 } // namespace 19 } // namespace
20 20
21 namespace media { 21 namespace media {
22 namespace cast { 22 namespace cast {
23 23
24 CastEnvironment::CastEnvironment( 24 CastEnvironment::CastEnvironment(
25 base::TickClock* clock, 25 scoped_ptr<base::TickClock> clock,
26 scoped_refptr<TaskRunner> main_thread_proxy, 26 scoped_refptr<TaskRunner> main_thread_proxy,
27 scoped_refptr<TaskRunner> audio_encode_thread_proxy, 27 scoped_refptr<TaskRunner> audio_encode_thread_proxy,
28 scoped_refptr<TaskRunner> audio_decode_thread_proxy, 28 scoped_refptr<TaskRunner> audio_decode_thread_proxy,
29 scoped_refptr<TaskRunner> video_encode_thread_proxy, 29 scoped_refptr<TaskRunner> video_encode_thread_proxy,
30 scoped_refptr<TaskRunner> video_decode_thread_proxy, 30 scoped_refptr<TaskRunner> video_decode_thread_proxy,
31 scoped_refptr<TaskRunner> transport_thread_proxy, 31 scoped_refptr<TaskRunner> transport_thread_proxy,
32 const CastLoggingConfig& config) 32 const CastLoggingConfig& config)
33 : clock_(clock), 33 : clock_(clock.Pass()),
34 main_thread_proxy_(main_thread_proxy), 34 main_thread_proxy_(main_thread_proxy),
35 audio_encode_thread_proxy_(audio_encode_thread_proxy), 35 audio_encode_thread_proxy_(audio_encode_thread_proxy),
36 audio_decode_thread_proxy_(audio_decode_thread_proxy), 36 audio_decode_thread_proxy_(audio_decode_thread_proxy),
37 video_encode_thread_proxy_(video_encode_thread_proxy), 37 video_encode_thread_proxy_(video_encode_thread_proxy),
38 video_decode_thread_proxy_(video_decode_thread_proxy), 38 video_decode_thread_proxy_(video_decode_thread_proxy),
39 transport_thread_proxy_(transport_thread_proxy), 39 transport_thread_proxy_(transport_thread_proxy),
40 logging_(new LoggingImpl(main_thread_proxy, config)) { 40 logging_(new LoggingImpl(main_thread_proxy, config)) {
41 DCHECK(main_thread_proxy) << "Main thread required"; 41 DCHECK(main_thread_proxy) << "Main thread required";
42 } 42 }
43 43
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return video_decode_thread_proxy_->RunsTasksOnCurrentThread(); 106 return video_decode_thread_proxy_->RunsTasksOnCurrentThread();
107 case CastEnvironment::TRANSPORT: 107 case CastEnvironment::TRANSPORT:
108 return transport_thread_proxy_->RunsTasksOnCurrentThread(); 108 return transport_thread_proxy_->RunsTasksOnCurrentThread();
109 default: 109 default:
110 NOTREACHED() << "Invalid thread identifier"; 110 NOTREACHED() << "Invalid thread identifier";
111 return false; 111 return false;
112 } 112 }
113 } 113 }
114 114
115 base::TickClock* CastEnvironment::Clock() const { 115 base::TickClock* CastEnvironment::Clock() const {
116 return clock_; 116 return clock_.get();
117 } 117 }
118 118
119 LoggingImpl* CastEnvironment::Logging() { 119 LoggingImpl* CastEnvironment::Logging() {
120 DCHECK(CurrentlyOn(CastEnvironment::MAIN)) << 120 DCHECK(CurrentlyOn(CastEnvironment::MAIN)) <<
121 "Must be called from main thread"; 121 "Must be called from main thread";
122 return logging_.get(); 122 return logging_.get();
123 } 123 }
124 124
125 } // namespace cast 125 } // namespace cast
126 } // namespace media 126 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/cast_environment.h ('k') | media/cast/rtcp/rtcp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698