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

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

Issue 670623002: Change base::TickClock to a ref counted class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@audio_redesign
Patch Set: y Created 6 years, 2 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 | « media/cast/cast_environment.h ('k') | media/cast/test/skewed_tick_clock.h » ('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::SingleThreadTaskRunner; 11 using base::SingleThreadTaskRunner;
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 scoped_ptr<base::TickClock> clock, 25 scoped_refptr<base::TickClock> clock,
26 scoped_refptr<SingleThreadTaskRunner> main_thread_proxy, 26 scoped_refptr<SingleThreadTaskRunner> main_thread_proxy,
27 scoped_refptr<SingleThreadTaskRunner> audio_thread_proxy, 27 scoped_refptr<SingleThreadTaskRunner> audio_thread_proxy,
28 scoped_refptr<SingleThreadTaskRunner> video_thread_proxy) 28 scoped_refptr<SingleThreadTaskRunner> video_thread_proxy)
29 : main_thread_proxy_(main_thread_proxy), 29 : main_thread_proxy_(main_thread_proxy),
30 audio_thread_proxy_(audio_thread_proxy), 30 audio_thread_proxy_(audio_thread_proxy),
31 video_thread_proxy_(video_thread_proxy), 31 video_thread_proxy_(video_thread_proxy),
32 clock_(clock.Pass()), 32 clock_(clock),
33 logging_(new LoggingImpl) {} 33 logging_(new LoggingImpl) {
34 }
34 35
35 CastEnvironment::~CastEnvironment() { 36 CastEnvironment::~CastEnvironment() {
36 // Logging must be deleted on the main thread. 37 // Logging must be deleted on the main thread.
37 if (main_thread_proxy_.get() && 38 if (main_thread_proxy_.get() &&
38 !main_thread_proxy_->RunsTasksOnCurrentThread()) { 39 !main_thread_proxy_->RunsTasksOnCurrentThread()) {
39 main_thread_proxy_->PostTask( 40 main_thread_proxy_->PostTask(
40 FROM_HERE, 41 FROM_HERE,
41 base::Bind(&DeleteLoggingOnMainThread, base::Passed(&logging_))); 42 base::Bind(&DeleteLoggingOnMainThread, base::Passed(&logging_)));
42 } 43 }
43 } 44 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return video_thread_proxy_.get() && 84 return video_thread_proxy_.get() &&
84 video_thread_proxy_->RunsTasksOnCurrentThread(); 85 video_thread_proxy_->RunsTasksOnCurrentThread();
85 default: 86 default:
86 NOTREACHED() << "Invalid thread identifier"; 87 NOTREACHED() << "Invalid thread identifier";
87 return false; 88 return false;
88 } 89 }
89 } 90 }
90 91
91 } // namespace cast 92 } // namespace cast
92 } // namespace media 93 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/cast_environment.h ('k') | media/cast/test/skewed_tick_clock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698