| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_HANDLE_TABLE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ |
| 6 #define MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ | 6 #define MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle) const; | 33 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle) const; |
| 34 MojoResult GetAndRemoveDispatcher(MojoHandle, | 34 MojoResult GetAndRemoveDispatcher(MojoHandle, |
| 35 scoped_refptr<Dispatcher>* dispatcher); | 35 scoped_refptr<Dispatcher>* dispatcher); |
| 36 | 36 |
| 37 // Marks handles as busy and populates |dispatchers|. Returns MOJO_RESULT_BUSY | 37 // Marks handles as busy and populates |dispatchers|. Returns MOJO_RESULT_BUSY |
| 38 // if any of the handles are already in transit; MOJO_RESULT_INVALID_ARGUMENT | 38 // if any of the handles are already in transit; MOJO_RESULT_INVALID_ARGUMENT |
| 39 // if any of the handles are invalid; or MOJO_RESULT_OK if successful. | 39 // if any of the handles are invalid; or MOJO_RESULT_OK if successful. |
| 40 MojoResult BeginTransit( | 40 MojoResult BeginTransit( |
| 41 const MojoHandle* handles, | 41 const MojoHandle* handles, |
| 42 uint32_t num_handles, | 42 uint32_t num_handles, |
| 43 std::vector<Dispatcher::DispatcherInTransit>* dispatchers); | 43 std::vector<Dispatcher::DispatcherInTransit>* dispatchers, |
| 44 Dispatcher::RequestContext* request_context); |
| 44 | 45 |
| 45 void CompleteTransitAndClose( | 46 void CompleteTransitAndClose( |
| 46 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers); | 47 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, |
| 48 Dispatcher::RequestContext* request_context); |
| 49 |
| 47 void CancelTransit( | 50 void CancelTransit( |
| 48 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers); | 51 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, |
| 52 Dispatcher::RequestContext* request_context); |
| 49 | 53 |
| 50 void GetActiveHandlesForTest(std::vector<MojoHandle> *handles); | 54 void GetActiveHandlesForTest(std::vector<MojoHandle> *handles); |
| 51 | 55 |
| 52 private: | 56 private: |
| 53 struct Entry { | 57 struct Entry { |
| 54 Entry(); | 58 Entry(); |
| 55 explicit Entry(scoped_refptr<Dispatcher> dispatcher); | 59 explicit Entry(scoped_refptr<Dispatcher> dispatcher); |
| 56 ~Entry(); | 60 ~Entry(); |
| 57 | 61 |
| 58 scoped_refptr<Dispatcher> dispatcher; | 62 scoped_refptr<Dispatcher> dispatcher; |
| 59 bool busy = false; | 63 bool busy = false; |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 using HandleMap = base::hash_map<MojoHandle, Entry>; | 66 using HandleMap = base::hash_map<MojoHandle, Entry>; |
| 63 | 67 |
| 64 HandleMap handles_; | 68 HandleMap handles_; |
| 65 | 69 |
| 66 uint32_t next_available_handle_ = 1; | 70 uint32_t next_available_handle_ = 1; |
| 67 | 71 |
| 68 DISALLOW_COPY_AND_ASSIGN(HandleTable); | 72 DISALLOW_COPY_AND_ASSIGN(HandleTable); |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 } // namespace edk | 75 } // namespace edk |
| 72 } // namespace mojo | 76 } // namespace mojo |
| 73 | 77 |
| 74 #endif // MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ | 78 #endif // MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ |
| OLD | NEW |