| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SLAVE_CONNECTION_MANAGER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_SLAVE_CONNECTION_MANAGER_H_ |
| 6 #define MOJO_EDK_SYSTEM_SLAVE_CONNECTION_MANAGER_H_ | 6 #define MOJO_EDK_SYSTEM_SLAVE_CONNECTION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "mojo/edk/embedder/scoped_platform_handle.h" | 13 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 14 #include "mojo/edk/embedder/slave_process_delegate.h" | 14 #include "mojo/edk/embedder/slave_process_delegate.h" |
| 15 #include "mojo/edk/system/connection_manager.h" | 15 #include "mojo/edk/system/connection_manager.h" |
| 16 #include "mojo/edk/system/mutex.h" | 16 #include "mojo/edk/system/mutex.h" |
| 17 #include "mojo/edk/system/raw_channel.h" | 17 #include "mojo/edk/system/raw_channel.h" |
| 18 #include "mojo/edk/system/system_impl_export.h" | |
| 19 #include "mojo/public/cpp/system/macros.h" | 18 #include "mojo/public/cpp/system/macros.h" |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class TaskRunner; | 21 class TaskRunner; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace mojo { | 24 namespace mojo { |
| 26 | 25 |
| 27 namespace embedder { | 26 namespace embedder { |
| 28 class SlaveProcessDelegate; | 27 class SlaveProcessDelegate; |
| 29 } | 28 } |
| 30 | 29 |
| 31 namespace system { | 30 namespace system { |
| 32 | 31 |
| 33 // The |ConnectionManager| implementation for slave processes. | 32 // The |ConnectionManager| implementation for slave processes. |
| 34 // | 33 // |
| 35 // This class is thread-safe (except that no public methods may be called from | 34 // This class is thread-safe (except that no public methods may be called from |
| 36 // its internal, private thread), with condition that |Init()| be called before | 35 // its internal, private thread), with condition that |Init()| be called before |
| 37 // anything else and |Shutdown()| be called before destruction (and no other | 36 // anything else and |Shutdown()| be called before destruction (and no other |
| 38 // public methods may be called during/after |Shutdown()|). | 37 // public methods may be called during/after |Shutdown()|). |
| 39 class MOJO_SYSTEM_IMPL_EXPORT SlaveConnectionManager final | 38 class SlaveConnectionManager final : public ConnectionManager, |
| 40 : public ConnectionManager, | 39 public RawChannel::Delegate { |
| 41 public RawChannel::Delegate { | |
| 42 public: | 40 public: |
| 43 // Note: None of the public methods may be called from |private_thread_|. | 41 // Note: None of the public methods may be called from |private_thread_|. |
| 44 | 42 |
| 45 // |platform_support| must be valid and remain alive until after |Shutdown()| | 43 // |platform_support| must be valid and remain alive until after |Shutdown()| |
| 46 // has completed. | 44 // has completed. |
| 47 explicit SlaveConnectionManager(embedder::PlatformSupport* platform_support); | 45 explicit SlaveConnectionManager(embedder::PlatformSupport* platform_support); |
| 48 ~SlaveConnectionManager() override; | 46 ~SlaveConnectionManager() override; |
| 49 | 47 |
| 50 // No other methods may be called until after this has been called. | 48 // No other methods may be called until after this has been called. |
| 51 // |delegate_thread_task_runner| should be the task runner for the "delegate | 49 // |delegate_thread_task_runner| should be the task runner for the "delegate |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 Mutex mutex_; | 148 Mutex mutex_; |
| 151 base::WaitableEvent event_; | 149 base::WaitableEvent event_; |
| 152 | 150 |
| 153 MOJO_DISALLOW_COPY_AND_ASSIGN(SlaveConnectionManager); | 151 MOJO_DISALLOW_COPY_AND_ASSIGN(SlaveConnectionManager); |
| 154 }; | 152 }; |
| 155 | 153 |
| 156 } // namespace system | 154 } // namespace system |
| 157 } // namespace mojo | 155 } // namespace mojo |
| 158 | 156 |
| 159 #endif // MOJO_EDK_SYSTEM_SLAVE_CONNECTION_MANAGER_H_ | 157 #endif // MOJO_EDK_SYSTEM_SLAVE_CONNECTION_MANAGER_H_ |
| OLD | NEW |