| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Called exactly once, shortly after construction, and before any other | 45 // Called exactly once, shortly after construction, and before any other |
| 46 // methods are called on this object. | 46 // methods are called on this object. |
| 47 void SetIOTaskRunner(scoped_refptr<base::TaskRunner> io_task_runner); | 47 void SetIOTaskRunner(scoped_refptr<base::TaskRunner> io_task_runner); |
| 48 | 48 |
| 49 // Retrieves the NodeController for the current process. | 49 // Retrieves the NodeController for the current process. |
| 50 NodeController* GetNodeController(); | 50 NodeController* GetNodeController(); |
| 51 | 51 |
| 52 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); | 52 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); |
| 53 | 53 |
| 54 void SetDefaultProcessErrorCallback(const ProcessErrorCallback& callback); |
| 55 |
| 54 // Called in the parent process any time a new child is launched. | 56 // Called in the parent process any time a new child is launched. |
| 55 void AddChild(base::ProcessHandle process_handle, | 57 void AddChild(base::ProcessHandle process_handle, |
| 56 ScopedPlatformHandle platform_handle, | 58 ScopedPlatformHandle platform_handle, |
| 57 const std::string& child_token, | 59 const std::string& child_token, |
| 58 const ProcessErrorCallback& process_error_callback); | 60 const ProcessErrorCallback& process_error_callback); |
| 59 | 61 |
| 60 // Called in the parent process when a child process fails to launch. | 62 // Called in the parent process when a child process fails to launch. |
| 61 void ChildLaunchFailed(const std::string& child_token); | 63 void ChildLaunchFailed(const std::string& child_token); |
| 62 | 64 |
| 63 // Called in a child process exactly once during early initialization. | 65 // Called in a child process exactly once during early initialization. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // Otherwise it's effectively const and shouldn't need to be guarded. | 285 // Otherwise it's effectively const and shouldn't need to be guarded. |
| 284 // | 286 // |
| 285 // We can get rid of lazy initialization if we defer Mojo initialization far | 287 // We can get rid of lazy initialization if we defer Mojo initialization far |
| 286 // enough that zygotes don't do it. The zygote can't create a NodeController. | 288 // enough that zygotes don't do it. The zygote can't create a NodeController. |
| 287 base::Lock node_controller_lock_; | 289 base::Lock node_controller_lock_; |
| 288 | 290 |
| 289 // This is lazily initialized on first access. Always use GetNodeController() | 291 // This is lazily initialized on first access. Always use GetNodeController() |
| 290 // to access it. | 292 // to access it. |
| 291 std::unique_ptr<NodeController> node_controller_; | 293 std::unique_ptr<NodeController> node_controller_; |
| 292 | 294 |
| 295 // The default callback to invoke, if any, when a process error is reported |
| 296 // but cannot be associated with a specific process. |
| 297 ProcessErrorCallback default_process_error_callback_; |
| 298 |
| 293 base::Lock handles_lock_; | 299 base::Lock handles_lock_; |
| 294 HandleTable handles_; | 300 HandleTable handles_; |
| 295 | 301 |
| 296 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 302 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
| 297 MappingTable mapping_table_; | 303 MappingTable mapping_table_; |
| 298 | 304 |
| 299 base::Lock property_lock_; | 305 base::Lock property_lock_; |
| 300 // Properties that can be read using the MojoGetProperty() API. | 306 // Properties that can be read using the MojoGetProperty() API. |
| 301 bool property_sync_call_allowed_ = true; | 307 bool property_sync_call_allowed_ = true; |
| 302 | 308 |
| 303 DISALLOW_COPY_AND_ASSIGN(Core); | 309 DISALLOW_COPY_AND_ASSIGN(Core); |
| 304 }; | 310 }; |
| 305 | 311 |
| 306 } // namespace edk | 312 } // namespace edk |
| 307 } // namespace mojo | 313 } // namespace mojo |
| 308 | 314 |
| 309 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 315 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
| OLD | NEW |