| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "mojo/edk/embedder/scoped_platform_handle.h" | 14 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 15 #include "mojo/edk/embedder/slave_process_delegate.h" | 15 #include "mojo/edk/embedder/slave_process_delegate.h" |
| 16 #include "mojo/edk/system/connection_manager.h" | 16 #include "mojo/edk/system/connection_manager.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" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class TaskRunner; | 21 class TaskRunner; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace mojo { | 24 namespace mojo { |
| 24 | 25 |
| 25 namespace embedder { | 26 namespace embedder { |
| 26 class SlaveProcessDelegate; | 27 class SlaveProcessDelegate; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace system { | 30 namespace system { |
| 30 | 31 |
| 31 // The |ConnectionManager| implementation for slave processes. | 32 // The |ConnectionManager| implementation for slave processes. |
| 32 // | 33 // |
| 33 // Objects of this class must created, initialized (via |Init()|), shut down | 34 // Objects of this class must created, initialized (via |Init()|), shut down |
| 34 // (via |Shutdown()|), and destroyed on the same thread (the "creation thread"). | 35 // (via |Shutdown()|), and destroyed on the same thread (the "creation thread"). |
| 35 // Otherwise, its public methods are thread-safe (except that they may not be | 36 // Otherwise, its public methods are thread-safe (except that they may not be |
| 36 // called from its internal, private thread). | 37 // called from its internal, private thread). |
| 37 class SlaveConnectionManager : public ConnectionManager, | 38 class MOJO_SYSTEM_IMPL_EXPORT SlaveConnectionManager |
| 38 public RawChannel::Delegate { | 39 : public ConnectionManager, |
| 40 public RawChannel::Delegate { |
| 39 public: | 41 public: |
| 40 // Note: None of the public methods may be called from |private_thread_|. | 42 // Note: None of the public methods may be called from |private_thread_|. |
| 41 | 43 |
| 42 SlaveConnectionManager(); | 44 SlaveConnectionManager(); |
| 43 ~SlaveConnectionManager() override; | 45 ~SlaveConnectionManager() override; |
| 44 | 46 |
| 45 // No other methods may be called until after this has been called. | 47 // No other methods may be called until after this has been called. |
| 46 // |slave_process_delegate| must stay alive at least until after |Shutdown()| | 48 // |slave_process_delegate| must stay alive at least until after |Shutdown()| |
| 47 // has been called; its methods will be called on this object's creation | 49 // has been called; its methods will be called on this object's creation |
| 48 // thread. | 50 // thread. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 base::Lock lock_; | 151 base::Lock lock_; |
| 150 base::WaitableEvent event_; | 152 base::WaitableEvent event_; |
| 151 | 153 |
| 152 DISALLOW_COPY_AND_ASSIGN(SlaveConnectionManager); | 154 DISALLOW_COPY_AND_ASSIGN(SlaveConnectionManager); |
| 153 }; | 155 }; |
| 154 | 156 |
| 155 } // namespace system | 157 } // namespace system |
| 156 } // namespace mojo | 158 } // namespace mojo |
| 157 | 159 |
| 158 #endif // MOJO_EDK_SYSTEM_SLAVE_CONNECTION_MANAGER_H_ | 160 #endif // MOJO_EDK_SYSTEM_SLAVE_CONNECTION_MANAGER_H_ |
| OLD | NEW |