| 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_CORE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CORE_H_ |
| 6 #define MOJO_EDK_SYSTEM_CORE_H_ | 6 #define MOJO_EDK_SYSTEM_CORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 14 #include "mojo/edk/system/handle_table.h" | 15 #include "mojo/edk/system/handle_table.h" |
| 15 #include "mojo/edk/system/mapping_table.h" | 16 #include "mojo/edk/system/mapping_table.h" |
| 16 #include "mojo/edk/system/memory.h" | 17 #include "mojo/edk/system/memory.h" |
| 17 #include "mojo/edk/system/system_impl_export.h" | 18 #include "mojo/edk/system/system_impl_export.h" |
| 18 #include "mojo/public/c/system/buffer.h" | 19 #include "mojo/public/c/system/buffer.h" |
| 19 #include "mojo/public/c/system/data_pipe.h" | 20 #include "mojo/public/c/system/data_pipe.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 virtual ~Core(); | 43 virtual ~Core(); |
| 43 | 44 |
| 44 // Adds |dispatcher| to the handle table, returning the handle for it. Returns | 45 // Adds |dispatcher| to the handle table, returning the handle for it. Returns |
| 45 // |MOJO_HANDLE_INVALID| on failure, namely if the handle table is full. | 46 // |MOJO_HANDLE_INVALID| on failure, namely if the handle table is full. |
| 46 MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher); | 47 MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher); |
| 47 | 48 |
| 48 // Looks up the dispatcher for the given handle. Returns null if the handle is | 49 // Looks up the dispatcher for the given handle. Returns null if the handle is |
| 49 // invalid. | 50 // invalid. |
| 50 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); | 51 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); |
| 51 | 52 |
| 53 // Watches on the given handle for the given signals, calling |callback| when |
| 54 // a signal is satisfied or when all signals become unsatisfiable. |callback| |
| 55 // must satisfy stringent requirements -- see |Awakable::Awake()| in |
| 56 // awakable.h. In particular, it must not call any Mojo system functions. |
| 57 MojoResult AsyncWait(MojoHandle handle, |
| 58 MojoHandleSignals signals, |
| 59 base::Callback<void(MojoResult)> callback); |
| 60 |
| 52 embedder::PlatformSupport* platform_support() const { | 61 embedder::PlatformSupport* platform_support() const { |
| 53 return platform_support_.get(); | 62 return platform_support_.get(); |
| 54 } | 63 } |
| 55 | 64 |
| 56 // --------------------------------------------------------------------------- | 65 // --------------------------------------------------------------------------- |
| 57 | 66 |
| 58 // System calls implementation: | 67 // System calls implementation: |
| 59 MojoTimeTicks GetTimeTicksNow(); | 68 MojoTimeTicks GetTimeTicksNow(); |
| 60 MojoResult Close(MojoHandle handle); | 69 MojoResult Close(MojoHandle handle); |
| 61 MojoResult Wait(MojoHandle handle, | 70 MojoResult Wait(MojoHandle handle, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 156 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
| 148 MappingTable mapping_table_; | 157 MappingTable mapping_table_; |
| 149 | 158 |
| 150 DISALLOW_COPY_AND_ASSIGN(Core); | 159 DISALLOW_COPY_AND_ASSIGN(Core); |
| 151 }; | 160 }; |
| 152 | 161 |
| 153 } // namespace system | 162 } // namespace system |
| 154 } // namespace mojo | 163 } // namespace mojo |
| 155 | 164 |
| 156 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 165 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
| OLD | NEW |