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

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

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_config.h ('k') | media/cast/cast_environment.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 #ifndef MEDIA_CAST_CAST_ENVIRONMENT_H_ 5 #ifndef MEDIA_CAST_CAST_ENVIRONMENT_H_
6 #define MEDIA_CAST_CAST_ENVIRONMENT_H_ 6 #define MEDIA_CAST_CAST_ENVIRONMENT_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/time/tick_clock.h" 13 #include "base/time/tick_clock.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "media/cast/logging/log_event_dispatcher.h" 15 #include "media/cast/logging/log_event_dispatcher.h"
15 16
16 namespace media { 17 namespace media {
17 namespace cast { 18 namespace cast {
18 19
19 class CastEnvironment : public base::RefCountedThreadSafe<CastEnvironment> { 20 class CastEnvironment : public base::RefCountedThreadSafe<CastEnvironment> {
20 public: 21 public:
21 // An enumeration of the cast threads. 22 // An enumeration of the cast threads.
22 enum ThreadId { 23 enum ThreadId {
23 // The main thread is where the cast system is configured and where timers 24 // The main thread is where the cast system is configured and where timers
24 // and network IO is performed. 25 // and network IO is performed.
25 MAIN, 26 MAIN,
26 // The audio thread is where all send side audio processing is done, 27 // The audio thread is where all send side audio processing is done,
27 // primarily encoding / decoding but also re-sampling. 28 // primarily encoding / decoding but also re-sampling.
28 AUDIO, 29 AUDIO,
29 // The video encoder thread is where the video processing is done. 30 // The video encoder thread is where the video processing is done.
30 VIDEO, 31 VIDEO,
31 }; 32 };
32 33
33 CastEnvironment( 34 CastEnvironment(
34 scoped_ptr<base::TickClock> clock, 35 std::unique_ptr<base::TickClock> clock,
35 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy, 36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy,
36 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy, 37 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy,
37 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy); 38 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy);
38 39
39 // These are the same methods in message_loop.h, but are guaranteed to either 40 // These are the same methods in message_loop.h, but are guaranteed to either
40 // get posted to the MessageLoop if it's still alive, or be deleted otherwise. 41 // get posted to the MessageLoop if it's still alive, or be deleted otherwise.
41 // They return true iff the thread existed and the task was posted. Note that 42 // They return true iff the thread existed and the task was posted. Note that
42 // even if the task is posted, there's no guarantee that it will run, since 43 // even if the task is posted, there's no guarantee that it will run, since
43 // the target thread may already have a Quit message in its queue. 44 // the target thread may already have a Quit message in its queue.
44 bool PostTask(ThreadId identifier, 45 bool PostTask(ThreadId identifier,
(...skipping 20 matching lines...) Expand all
65 66
66 bool HasVideoThread() { return video_thread_proxy_.get() ? true : false; } 67 bool HasVideoThread() { return video_thread_proxy_.get() ? true : false; }
67 68
68 protected: 69 protected:
69 virtual ~CastEnvironment(); 70 virtual ~CastEnvironment();
70 71
71 // Subclasses may final these. 72 // Subclasses may final these.
72 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy_; 73 scoped_refptr<base::SingleThreadTaskRunner> main_thread_proxy_;
73 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy_; 74 scoped_refptr<base::SingleThreadTaskRunner> audio_thread_proxy_;
74 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy_; 75 scoped_refptr<base::SingleThreadTaskRunner> video_thread_proxy_;
75 scoped_ptr<base::TickClock> clock_; 76 std::unique_ptr<base::TickClock> clock_;
76 LogEventDispatcher logger_; 77 LogEventDispatcher logger_;
77 78
78 private: 79 private:
79 friend class base::RefCountedThreadSafe<CastEnvironment>; 80 friend class base::RefCountedThreadSafe<CastEnvironment>;
80 81
81 DISALLOW_COPY_AND_ASSIGN(CastEnvironment); 82 DISALLOW_COPY_AND_ASSIGN(CastEnvironment);
82 }; 83 };
83 84
84 } // namespace cast 85 } // namespace cast
85 } // namespace media 86 } // namespace media
86 87
87 #endif // MEDIA_CAST_CAST_ENVIRONMENT_H_ 88 #endif // MEDIA_CAST_CAST_ENVIRONMENT_H_
OLDNEW
« no previous file with comments | « media/cast/cast_config.h ('k') | media/cast/cast_environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698