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

Side by Side Diff: ppapi/shared_impl/thread_aware_callback.h

Issue 174213003: PPAPI: Use clang-format on ppapi/shared_impl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: remove DEPS Created 6 years, 10 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 | « ppapi/shared_impl/test_globals.cc ('k') | ppapi/shared_impl/thread_aware_callback.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 (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 #ifndef PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_ 5 #ifndef PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_
6 #define PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_ 6 #define PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 public: 57 public:
58 // The caller takes ownership of the returned object. 58 // The caller takes ownership of the returned object.
59 // NULL is returned if the current thread doesn't have an associated Pepper 59 // NULL is returned if the current thread doesn't have an associated Pepper
60 // message loop, or |func| is NULL. 60 // message loop, or |func| is NULL.
61 static ThreadAwareCallback* Create(FuncType func) { 61 static ThreadAwareCallback* Create(FuncType func) {
62 if (!func || !HasTargetLoop()) 62 if (!func || !HasTargetLoop())
63 return NULL; 63 return NULL;
64 return new ThreadAwareCallback(func); 64 return new ThreadAwareCallback(func);
65 } 65 }
66 66
67 ~ThreadAwareCallback() { 67 ~ThreadAwareCallback() {}
68 }
69 68
70 void RunOnTargetThread() { 69 void RunOnTargetThread() { InternalRunOnTargetThread(base::Bind(func_)); }
71 InternalRunOnTargetThread(base::Bind(func_));
72 }
73 70
74 template <class P1> 71 template <class P1>
75 void RunOnTargetThread(const P1& p1) { 72 void RunOnTargetThread(const P1& p1) {
76 InternalRunOnTargetThread(base::Bind(func_, p1)); 73 InternalRunOnTargetThread(base::Bind(func_, p1));
77 } 74 }
78 75
79 template <class P1, class P2> 76 template <class P1, class P2>
80 void RunOnTargetThread(const P1& p1, const P2& p2) { 77 void RunOnTargetThread(const P1& p1, const P2& p2) {
81 InternalRunOnTargetThread(base::Bind(func_, p1, p2)); 78 InternalRunOnTargetThread(base::Bind(func_, p1, p2));
82 } 79 }
(...skipping 14 matching lines...) Expand all
97 template <class P1, class P2, class P3, class P4, class P5> 94 template <class P1, class P2, class P3, class P4, class P5>
98 void RunOnTargetThread(const P1& p1, 95 void RunOnTargetThread(const P1& p1,
99 const P2& p2, 96 const P2& p2,
100 const P3& p3, 97 const P3& p3,
101 const P4& p4, 98 const P4& p4,
102 const P5& p5) { 99 const P5& p5) {
103 InternalRunOnTargetThread(base::Bind(func_, p1, p2, p3, p4, p5)); 100 InternalRunOnTargetThread(base::Bind(func_, p1, p2, p3, p4, p5));
104 } 101 }
105 102
106 private: 103 private:
107 explicit ThreadAwareCallback(FuncType func) : func_(func) { 104 explicit ThreadAwareCallback(FuncType func) : func_(func) {}
108 }
109 105
110 FuncType func_; 106 FuncType func_;
111 }; 107 };
112 108
113 } // namespace ppapi 109 } // namespace ppapi
114 110
115 #endif // PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_ 111 #endif // PPAPI_SHARED_IMPL_THREAD_AWARE_CALLBACK_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/test_globals.cc ('k') | ppapi/shared_impl/thread_aware_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698