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_MASTER_CONNECTION_MANAGER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MASTER_CONNECTION_MANAGER_H_ |
6 #define MOJO_EDK_SYSTEM_MASTER_CONNECTION_MANAGER_H_ | 6 #define MOJO_EDK_SYSTEM_MASTER_CONNECTION_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <unordered_map> | 10 #include <unordered_map> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.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/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/system_impl_export.h" | |
18 #include "mojo/public/cpp/system/macros.h" | 17 #include "mojo/public/cpp/system/macros.h" |
19 | 18 |
20 namespace base { | 19 namespace base { |
21 class TaskRunner; | 20 class TaskRunner; |
22 class WaitableEvent; | 21 class WaitableEvent; |
23 } | 22 } |
24 | 23 |
25 namespace mojo { | 24 namespace mojo { |
26 | 25 |
27 namespace embedder { | 26 namespace embedder { |
28 class MasterProcessDelegate; | 27 class MasterProcessDelegate; |
29 using SlaveInfo = void*; | 28 using SlaveInfo = void*; |
30 } | 29 } |
31 | 30 |
32 namespace system { | 31 namespace system { |
33 | 32 |
34 // The |ConnectionManager| implementation for the master process. | 33 // The |ConnectionManager| implementation for the master process. |
35 // | 34 // |
36 // This class is thread-safe (except that no public methods may be called from | 35 // This class is thread-safe (except that no public methods may be called from |
37 // its internal, private thread), with condition that |Init()| be called before | 36 // its internal, private thread), with condition that |Init()| be called before |
38 // anything else and |Shutdown()| be called before destruction (and no other | 37 // anything else and |Shutdown()| be called before destruction (and no other |
39 // public methods may be called during/after |Shutdown()|). | 38 // public methods may be called during/after |Shutdown()|). |
40 class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager final | 39 class MasterConnectionManager final : public ConnectionManager { |
41 : public ConnectionManager { | |
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 MasterConnectionManager(embedder::PlatformSupport* platform_support); | 45 explicit MasterConnectionManager(embedder::PlatformSupport* platform_support); |
48 ~MasterConnectionManager() override; | 46 ~MasterConnectionManager() 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 std::unordered_map<ProcessIdentifier, ProcessConnections*> connections_ | 168 std::unordered_map<ProcessIdentifier, ProcessConnections*> connections_ |
171 MOJO_GUARDED_BY(mutex_); // Owns its values. | 169 MOJO_GUARDED_BY(mutex_); // Owns its values. |
172 | 170 |
173 MOJO_DISALLOW_COPY_AND_ASSIGN(MasterConnectionManager); | 171 MOJO_DISALLOW_COPY_AND_ASSIGN(MasterConnectionManager); |
174 }; | 172 }; |
175 | 173 |
176 } // namespace system | 174 } // namespace system |
177 } // namespace mojo | 175 } // namespace mojo |
178 | 176 |
179 #endif // MOJO_EDK_SYSTEM_MASTER_CONNECTION_MANAGER_H_ | 177 #endif // MOJO_EDK_SYSTEM_MASTER_CONNECTION_MANAGER_H_ |
OLD | NEW |