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

Side by Side Diff: chromecast/base/bind_to_task_runner.h

Issue 1875623002: Convert //chromecast 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROMECAST_BASE_BIND_TO_TASK_RUNNER_H_ 5 #ifndef CHROMECAST_BASE_BIND_TO_TASK_RUNNER_H_
6 #define CHROMECAST_BASE_BIND_TO_TASK_RUNNER_H_ 6 #define CHROMECAST_BASE_BIND_TO_TASK_RUNNER_H_
7 7
8 #include <memory>
9
8 #include "base/bind.h" 10 #include "base/bind.h"
9 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "base/location.h" 13 #include "base/location.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "base/task_runner.h" 16 #include "base/task_runner.h"
16 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
17 18
18 // This is a helper utility for Bind()ing callbacks to a given TaskRunner. 19 // This is a helper utility for Bind()ing callbacks to a given TaskRunner.
19 // The typical use is when |a| (of class |A|) wants to hand a callback such as 20 // The typical use is when |a| (of class |A|) wants to hand a callback such as
20 // base::Bind(&A::AMethod, a) to |b|, but needs to ensure that when |b| executes 21 // base::Bind(&A::AMethod, a) to |b|, but needs to ensure that when |b| executes
21 // the callback, it does so on a specific TaskRunner (for example, |a|'s current 22 // the callback, it does so on a specific TaskRunner (for example, |a|'s current
22 // MessageLoop). 23 // MessageLoop).
23 // 24 //
(...skipping 11 matching lines...) Expand all
35 36
36 namespace chromecast { 37 namespace chromecast {
37 namespace bind_helpers { 38 namespace bind_helpers {
38 39
39 template <typename T> 40 template <typename T>
40 T& TrampolineForward(T& t) { 41 T& TrampolineForward(T& t) {
41 return t; 42 return t;
42 } 43 }
43 44
44 template <typename T, typename R> 45 template <typename T, typename R>
45 base::internal::PassedWrapper<scoped_ptr<T, R>> TrampolineForward( 46 base::internal::PassedWrapper<std::unique_ptr<T, R>> TrampolineForward(
46 scoped_ptr<T, R>& p) { 47 std::unique_ptr<T, R>& p) {
47 return base::Passed(&p); 48 return base::Passed(&p);
48 } 49 }
49 50
50 template <typename T> 51 template <typename T>
51 base::internal::PassedWrapper<ScopedVector<T>> TrampolineForward( 52 base::internal::PassedWrapper<ScopedVector<T>> TrampolineForward(
52 ScopedVector<T>& p) { 53 ScopedVector<T>& p) {
53 return base::Passed(&p); 54 return base::Passed(&p);
54 } 55 }
55 56
56 template <typename Sig> 57 template <typename Sig>
(...skipping 20 matching lines...) Expand all
77 } 78 }
78 79
79 template <typename T> 80 template <typename T>
80 base::Callback<T> BindToCurrentThread(const base::Callback<T>& cb) { 81 base::Callback<T> BindToCurrentThread(const base::Callback<T>& cb) {
81 return BindToTaskRunner(base::ThreadTaskRunnerHandle::Get(), cb); 82 return BindToTaskRunner(base::ThreadTaskRunnerHandle::Get(), cb);
82 } 83 }
83 84
84 } // namespace chromecast 85 } // namespace chromecast
85 86
86 #endif // CHROMECAST_BASE_BIND_TO_TASK_RUNNER_H_ 87 #endif // CHROMECAST_BASE_BIND_TO_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « chromecast/app/linux/cast_crash_reporter_client_unittest.cc ('k') | chromecast/base/bind_to_task_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698