OLD | NEW |
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 MOJO_EDK_SYSTEM_DISPATCHER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_DISPATCHER_H_ |
6 #define MOJO_EDK_SYSTEM_DISPATCHER_H_ | 6 #define MOJO_EDK_SYSTEM_DISPATCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 virtual void TransportEnded() {} | 293 virtual void TransportEnded() {} |
294 | 294 |
295 // This should be overridden to return true if/when there's an ongoing | 295 // This should be overridden to return true if/when there's an ongoing |
296 // operation (e.g., two-phase read/writes on data pipes) that should prevent a | 296 // operation (e.g., two-phase read/writes on data pipes) that should prevent a |
297 // handle from being sent over a message pipe (with status "busy"). | 297 // handle from being sent over a message pipe (with status "busy"). |
298 virtual bool IsBusyNoLock() const; | 298 virtual bool IsBusyNoLock() const; |
299 | 299 |
300 // Available to subclasses. (Note: Returns a non-const reference, just like | 300 // Available to subclasses. (Note: Returns a non-const reference, just like |
301 // |base::AutoLock|'s constructor takes a non-const reference.) | 301 // |base::AutoLock|'s constructor takes a non-const reference.) |
302 base::Lock& lock() const { return lock_; } | 302 base::Lock& lock() const { return lock_; } |
| 303 bool is_closed() const { return is_closed_; } |
303 | 304 |
304 private: | 305 private: |
305 friend class DispatcherTransport; | 306 friend class DispatcherTransport; |
306 | 307 |
307 // Closes the dispatcher. This must be done under lock, and unlike |Close()|, | 308 // Closes the dispatcher. This must be done under lock, and unlike |Close()|, |
308 // the dispatcher must not be closed already. (This is the "equivalent" of | 309 // the dispatcher must not be closed already. (This is the "equivalent" of |
309 // |CreateEquivalentDispatcherAndCloseNoLock()|, for situations where the | 310 // |CreateEquivalentDispatcherAndCloseNoLock()|, for situations where the |
310 // dispatcher must be disposed of instead of "transferred".) | 311 // dispatcher must be disposed of instead of "transferred".) |
311 void CloseNoLock(); | 312 void CloseNoLock(); |
312 | 313 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // So logging macros and |DCHECK_EQ()|, etc. work. | 393 // So logging macros and |DCHECK_EQ()|, etc. work. |
393 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, | 394 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, |
394 Dispatcher::Type type) { | 395 Dispatcher::Type type) { |
395 return out << static_cast<int>(type); | 396 return out << static_cast<int>(type); |
396 } | 397 } |
397 | 398 |
398 } // namespace edk | 399 } // namespace edk |
399 } // namespace mojo | 400 } // namespace mojo |
400 | 401 |
401 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ | 402 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ |
OLD | NEW |