OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TRACKED_CALLBACK_H_ | 5 #ifndef PPAPI_SHARED_IMPL_TRACKED_CALLBACK_H_ |
6 #define PPAPI_SHARED_IMPL_TRACKED_CALLBACK_H_ | 6 #define PPAPI_SHARED_IMPL_TRACKED_CALLBACK_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return !callback_.func; | 110 return !callback_.func; |
111 } | 111 } |
112 bool is_required() { | 112 bool is_required() { |
113 return (callback_.func && | 113 return (callback_.func && |
114 !(callback_.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL)); | 114 !(callback_.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL)); |
115 } | 115 } |
116 bool is_optional() { | 116 bool is_optional() { |
117 return (callback_.func && | 117 return (callback_.func && |
118 (callback_.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL)); | 118 (callback_.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL)); |
119 } | 119 } |
120 bool has_null_target_loop() const { | 120 bool has_null_target_loop() const { return target_loop_.get() == NULL; } |
121 return target_loop_ == NULL; | |
122 } | |
123 | 121 |
124 private: | 122 private: |
125 // TrackedCallback and EnterBase manage dealing with how to invoke callbacks | 123 // TrackedCallback and EnterBase manage dealing with how to invoke callbacks |
126 // appropriately. Pepper interface implementations and proxies should not have | 124 // appropriately. Pepper interface implementations and proxies should not have |
127 // to check the type of callback, block, or mark them complete explicitly. | 125 // to check the type of callback, block, or mark them complete explicitly. |
128 friend class ppapi::thunk::subtle::EnterBase; | 126 friend class ppapi::thunk::subtle::EnterBase; |
129 | 127 |
130 // Block until the associated operation has completed. Returns the result. | 128 // Block until the associated operation has completed. Returns the result. |
131 // This must only be called on a non-main thread on a blocking callback. | 129 // This must only be called on a non-main thread on a blocking callback. |
132 int32_t BlockUntilComplete(); | 130 int32_t BlockUntilComplete(); |
(...skipping 26 matching lines...) Expand all Loading... |
159 // callback. Note that in-process, there is no lock, blocking callbacks are | 157 // callback. Note that in-process, there is no lock, blocking callbacks are |
160 // not allowed, and therefore this pointer will be NULL. | 158 // not allowed, and therefore this pointer will be NULL. |
161 scoped_ptr<base::ConditionVariable> operation_completed_condvar_; | 159 scoped_ptr<base::ConditionVariable> operation_completed_condvar_; |
162 | 160 |
163 DISALLOW_IMPLICIT_CONSTRUCTORS(TrackedCallback); | 161 DISALLOW_IMPLICIT_CONSTRUCTORS(TrackedCallback); |
164 }; | 162 }; |
165 | 163 |
166 } // namespace ppapi | 164 } // namespace ppapi |
167 | 165 |
168 #endif // PPAPI_SHARED_IMPL_TRACKED_CALLBACK_H_ | 166 #endif // PPAPI_SHARED_IMPL_TRACKED_CALLBACK_H_ |
OLD | NEW |