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_SYSTEM_CORE_H_ | 5 #ifndef MOJO_SYSTEM_CORE_H_ |
6 #define MOJO_SYSTEM_CORE_H_ | 6 #define MOJO_SYSTEM_CORE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher); | 35 MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher); |
36 | 36 |
37 // Looks up the dispatcher for the given handle. Returns null if the handle is | 37 // Looks up the dispatcher for the given handle. Returns null if the handle is |
38 // invalid. | 38 // invalid. |
39 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); | 39 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); |
40 | 40 |
41 // System calls implementation. | 41 // System calls implementation. |
42 MojoTimeTicks GetTimeTicksNow(); | 42 MojoTimeTicks GetTimeTicksNow(); |
43 MojoResult Close(MojoHandle handle); | 43 MojoResult Close(MojoHandle handle); |
44 MojoResult Wait(MojoHandle handle, | 44 MojoResult Wait(MojoHandle handle, |
45 MojoWaitFlags flags, | 45 MojoHandleSignals signals, |
46 MojoDeadline deadline); | 46 MojoDeadline deadline); |
47 MojoResult WaitMany(const MojoHandle* handles, | 47 MojoResult WaitMany(const MojoHandle* handles, |
48 const MojoWaitFlags* flags, | 48 const MojoHandleSignals* signals, |
49 uint32_t num_handles, | 49 uint32_t num_handles, |
50 MojoDeadline deadline); | 50 MojoDeadline deadline); |
51 MojoResult CreateMessagePipe(const MojoCreateMessagePipeOptions* options, | 51 MojoResult CreateMessagePipe(const MojoCreateMessagePipeOptions* options, |
52 MojoHandle* message_pipe_handle0, | 52 MojoHandle* message_pipe_handle0, |
53 MojoHandle* message_pipe_handle1); | 53 MojoHandle* message_pipe_handle1); |
54 MojoResult WriteMessage(MojoHandle message_pipe_handle, | 54 MojoResult WriteMessage(MojoHandle message_pipe_handle, |
55 const void* bytes, | 55 const void* bytes, |
56 uint32_t num_bytes, | 56 uint32_t num_bytes, |
57 const MojoHandle* handles, | 57 const MojoHandle* handles, |
58 uint32_t num_handles, | 58 uint32_t num_handles, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void** buffer, | 99 void** buffer, |
100 MojoMapBufferFlags flags); | 100 MojoMapBufferFlags flags); |
101 MojoResult UnmapBuffer(void* buffer); | 101 MojoResult UnmapBuffer(void* buffer); |
102 | 102 |
103 private: | 103 private: |
104 friend bool internal::ShutdownCheckNoLeaks(Core*); | 104 friend bool internal::ShutdownCheckNoLeaks(Core*); |
105 | 105 |
106 // Internal implementation of |Wait()| and |WaitMany()|; doesn't do basic | 106 // Internal implementation of |Wait()| and |WaitMany()|; doesn't do basic |
107 // validation of arguments. | 107 // validation of arguments. |
108 MojoResult WaitManyInternal(const MojoHandle* handles, | 108 MojoResult WaitManyInternal(const MojoHandle* handles, |
109 const MojoWaitFlags* flags, | 109 const MojoHandleSignals* signals, |
110 uint32_t num_handles, | 110 uint32_t num_handles, |
111 MojoDeadline deadline); | 111 MojoDeadline deadline); |
112 | 112 |
113 // --------------------------------------------------------------------------- | 113 // --------------------------------------------------------------------------- |
114 | 114 |
115 // TODO(vtl): |handle_table_lock_| should be a reader-writer lock (if only we | 115 // TODO(vtl): |handle_table_lock_| should be a reader-writer lock (if only we |
116 // had them). | 116 // had them). |
117 base::Lock handle_table_lock_; // Protects |handle_table_|. | 117 base::Lock handle_table_lock_; // Protects |handle_table_|. |
118 HandleTable handle_table_; | 118 HandleTable handle_table_; |
119 | 119 |
120 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 120 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
121 MappingTable mapping_table_; | 121 MappingTable mapping_table_; |
122 | 122 |
123 // --------------------------------------------------------------------------- | 123 // --------------------------------------------------------------------------- |
124 | 124 |
125 DISALLOW_COPY_AND_ASSIGN(Core); | 125 DISALLOW_COPY_AND_ASSIGN(Core); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace system | 128 } // namespace system |
129 } // namespace mojo | 129 } // namespace mojo |
130 | 130 |
131 #endif // MOJO_SYSTEM_CORE_H_ | 131 #endif // MOJO_SYSTEM_CORE_H_ |
OLD | NEW |