| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHANNEL_MANAGER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_ |
| 6 #define MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_ | 6 #define MOJO_EDK_SYSTEM_CHANNEL_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/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "mojo/edk/embedder/platform_task_runner.h" | 13 #include "mojo/edk/embedder/platform_task_runner.h" |
| 14 #include "mojo/edk/embedder/scoped_platform_handle.h" | 14 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 15 #include "mojo/edk/system/channel_id.h" | 15 #include "mojo/edk/system/channel_id.h" |
| 16 #include "mojo/edk/system/mutex.h" | 16 #include "mojo/edk/util/mutex.h" |
| 17 #include "mojo/edk/util/ref_ptr.h" | 17 #include "mojo/edk/util/ref_ptr.h" |
| 18 #include "mojo/edk/util/thread_annotations.h" |
| 18 #include "mojo/public/cpp/system/macros.h" | 19 #include "mojo/public/cpp/system/macros.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class TaskRunner; | 22 class TaskRunner; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace mojo { | 25 namespace mojo { |
| 25 | 26 |
| 26 namespace embedder { | 27 namespace embedder { |
| 27 class PlatformSupport; | 28 class PlatformSupport; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 146 |
| 146 // Note: These must not be used after shutdown. | 147 // Note: These must not be used after shutdown. |
| 147 embedder::PlatformSupport* const platform_support_; | 148 embedder::PlatformSupport* const platform_support_; |
| 148 const embedder::PlatformTaskRunnerRefPtr io_thread_task_runner_; | 149 const embedder::PlatformTaskRunnerRefPtr io_thread_task_runner_; |
| 149 ConnectionManager* const connection_manager_; | 150 ConnectionManager* const connection_manager_; |
| 150 | 151 |
| 151 // Note: |Channel| methods should not be called under |mutex_|. | 152 // Note: |Channel| methods should not be called under |mutex_|. |
| 152 // TODO(vtl): Annotate the above rule using |MOJO_ACQUIRED_{BEFORE,AFTER}()|, | 153 // TODO(vtl): Annotate the above rule using |MOJO_ACQUIRED_{BEFORE,AFTER}()|, |
| 153 // once clang actually checks such annotations. | 154 // once clang actually checks such annotations. |
| 154 // https://github.com/domokit/mojo/issues/313 | 155 // https://github.com/domokit/mojo/issues/313 |
| 155 mutable Mutex mutex_; | 156 mutable util::Mutex mutex_; |
| 156 | 157 |
| 157 using ChannelIdToChannelMap = | 158 using ChannelIdToChannelMap = |
| 158 std::unordered_map<ChannelId, util::RefPtr<Channel>>; | 159 std::unordered_map<ChannelId, util::RefPtr<Channel>>; |
| 159 ChannelIdToChannelMap channels_ MOJO_GUARDED_BY(mutex_); | 160 ChannelIdToChannelMap channels_ MOJO_GUARDED_BY(mutex_); |
| 160 | 161 |
| 161 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelManager); | 162 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelManager); |
| 162 }; | 163 }; |
| 163 | 164 |
| 164 } // namespace system | 165 } // namespace system |
| 165 } // namespace mojo | 166 } // namespace mojo |
| 166 | 167 |
| 167 #endif // MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_ | 168 #endif // MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_ |
| OLD | NEW |