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 <memory> | 8 #include <memory> |
| 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/shared_memory_handle.h" | 15 #include "base/memory/shared_memory_handle.h" |
15 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
16 #include "base/task_runner.h" | 17 #include "base/task_runner.h" |
17 #include "mojo/edk/embedder/scoped_platform_handle.h" | 18 #include "mojo/edk/embedder/scoped_platform_handle.h" |
18 #include "mojo/edk/system/dispatcher.h" | 19 #include "mojo/edk/system/dispatcher.h" |
(...skipping 13 matching lines...) Expand all Loading... |
32 class PortProvider; | 33 class PortProvider; |
33 } | 34 } |
34 | 35 |
35 namespace mojo { | 36 namespace mojo { |
36 namespace edk { | 37 namespace edk { |
37 | 38 |
38 // |Core| is an object that implements the Mojo system calls. All public methods | 39 // |Core| is an object that implements the Mojo system calls. All public methods |
39 // are thread-safe. | 40 // are thread-safe. |
40 class MOJO_SYSTEM_IMPL_EXPORT Core { | 41 class MOJO_SYSTEM_IMPL_EXPORT Core { |
41 public: | 42 public: |
42 explicit Core(); | 43 Core(); |
43 virtual ~Core(); | 44 virtual ~Core(); |
44 | 45 |
45 // Called exactly once, shortly after construction, and before any other | 46 // Called exactly once, shortly after construction, and before any other |
46 // methods are called on this object. | 47 // methods are called on this object. |
47 void SetIOTaskRunner(scoped_refptr<base::TaskRunner> io_task_runner); | 48 void SetIOTaskRunner(scoped_refptr<base::TaskRunner> io_task_runner); |
48 | 49 |
49 // Retrieves the NodeController for the current process. | 50 // Retrieves the NodeController for the current process. |
50 NodeController* GetNodeController(); | 51 NodeController* GetNodeController(); |
51 | 52 |
52 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); | 53 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 size_t* size, | 272 size_t* size, |
272 MojoPlatformSharedBufferHandleFlags* flags); | 273 MojoPlatformSharedBufferHandleFlags* flags); |
273 | 274 |
274 void GetActiveHandlesForTest(std::vector<MojoHandle>* handles); | 275 void GetActiveHandlesForTest(std::vector<MojoHandle>* handles); |
275 | 276 |
276 private: | 277 private: |
277 MojoResult WaitManyInternal(const MojoHandle* handles, | 278 MojoResult WaitManyInternal(const MojoHandle* handles, |
278 const MojoHandleSignals* signals, | 279 const MojoHandleSignals* signals, |
279 uint32_t num_handles, | 280 uint32_t num_handles, |
280 MojoDeadline deadline, | 281 MojoDeadline deadline, |
281 uint32_t *result_index, | 282 uint32_t* result_index, |
282 HandleSignalsState* signals_states); | 283 HandleSignalsState* signals_states); |
283 | 284 |
284 // Used to pass ownership of our NodeController over to the IO thread in the | 285 // Used to pass ownership of our NodeController over to the IO thread in the |
285 // event that we're torn down before said thread. | 286 // event that we're torn down before said thread. |
286 static void PassNodeControllerToIOThread( | 287 static void PassNodeControllerToIOThread( |
287 std::unique_ptr<NodeController> node_controller); | 288 std::unique_ptr<NodeController> node_controller); |
288 | 289 |
289 // Guards node_controller_. | 290 // Guards node_controller_. |
290 // | 291 // |
291 // TODO(rockot): Consider removing this. It's only needed because we | 292 // TODO(rockot): Consider removing this. It's only needed because we |
(...skipping 22 matching lines...) Expand all Loading... |
314 // Properties that can be read using the MojoGetProperty() API. | 315 // Properties that can be read using the MojoGetProperty() API. |
315 bool property_sync_call_allowed_ = true; | 316 bool property_sync_call_allowed_ = true; |
316 | 317 |
317 DISALLOW_COPY_AND_ASSIGN(Core); | 318 DISALLOW_COPY_AND_ASSIGN(Core); |
318 }; | 319 }; |
319 | 320 |
320 } // namespace edk | 321 } // namespace edk |
321 } // namespace mojo | 322 } // namespace mojo |
322 | 323 |
323 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 324 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
OLD | NEW |