| 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_SYSTEM_DISPATCHER_H_ | 5 #ifndef MOJO_SYSTEM_DISPATCHER_H_ |
| 6 #define MOJO_SYSTEM_DISPATCHER_H_ | 6 #define MOJO_SYSTEM_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "mojo/embedder/platform_handle.h" | 17 #include "mojo/embedder/platform_handle.h" |
| 18 #include "mojo/public/c/system/core.h" | 18 #include "mojo/public/c/system/core.h" |
| 19 #include "mojo/system/system_impl_export.h" | 19 #include "mojo/system/system_impl_export.h" |
| 20 | 20 |
| 21 namespace mojo { | 21 namespace mojo { |
| 22 namespace system { | 22 namespace system { |
| 23 | 23 |
| 24 class Channel; | 24 class Channel; |
| 25 class CoreImpl; | 25 class Core; |
| 26 class Dispatcher; | 26 class Dispatcher; |
| 27 class DispatcherTransport; | 27 class DispatcherTransport; |
| 28 class HandleTable; | 28 class HandleTable; |
| 29 class LocalMessagePipeEndpoint; | 29 class LocalMessagePipeEndpoint; |
| 30 class MessageInTransit; | 30 class MessageInTransit; |
| 31 class ProxyMessagePipeEndpoint; | 31 class ProxyMessagePipeEndpoint; |
| 32 class RawSharedBufferMapping; | 32 class RawSharedBufferMapping; |
| 33 class Waiter; | 33 class Waiter; |
| 34 | 34 |
| 35 namespace test { | 35 namespace test { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // A dispatcher must be put into a special state in order to be sent across a | 128 // A dispatcher must be put into a special state in order to be sent across a |
| 129 // message pipe. Outside of tests, only |HandleTableAccess| is allowed to do | 129 // message pipe. Outside of tests, only |HandleTableAccess| is allowed to do |
| 130 // this, since there are requirements on the handle table (see below). | 130 // this, since there are requirements on the handle table (see below). |
| 131 // | 131 // |
| 132 // In this special state, only a restricted set of operations is allowed. | 132 // In this special state, only a restricted set of operations is allowed. |
| 133 // These are the ones available as |DispatcherTransport| methods. Other | 133 // These are the ones available as |DispatcherTransport| methods. Other |
| 134 // |Dispatcher| methods must not be called until |DispatcherTransport::End()| | 134 // |Dispatcher| methods must not be called until |DispatcherTransport::End()| |
| 135 // has been called. | 135 // has been called. |
| 136 class HandleTableAccess { | 136 class HandleTableAccess { |
| 137 private: | 137 private: |
| 138 friend class CoreImpl; | 138 friend class Core; |
| 139 friend class HandleTable; | 139 friend class HandleTable; |
| 140 // Tests also need this, to avoid needing |CoreImpl|. | 140 // Tests also need this, to avoid needing |Core|. |
| 141 friend DispatcherTransport test::DispatcherTryStartTransport(Dispatcher*); | 141 friend DispatcherTransport test::DispatcherTryStartTransport(Dispatcher*); |
| 142 | 142 |
| 143 // This must be called under the handle table lock and only if the handle | 143 // This must be called under the handle table lock and only if the handle |
| 144 // table entry is not marked busy. The caller must maintain a reference to | 144 // table entry is not marked busy. The caller must maintain a reference to |
| 145 // |dispatcher| until |DispatcherTransport::End()| is called. | 145 // |dispatcher| until |DispatcherTransport::End()| is called. |
| 146 static DispatcherTransport TryStartTransport(Dispatcher* dispatcher); | 146 static DispatcherTransport TryStartTransport(Dispatcher* dispatcher); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 // A |MessageInTransit| may serialize dispatchers that are attached to it to a | 149 // A |MessageInTransit| may serialize dispatchers that are attached to it to a |
| 150 // given |Channel| and then (probably in a different process) deserialize. | 150 // given |Channel| and then (probably in a different process) deserialize. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 360 |
| 361 Dispatcher* dispatcher_; | 361 Dispatcher* dispatcher_; |
| 362 | 362 |
| 363 // Copy and assign allowed. | 363 // Copy and assign allowed. |
| 364 }; | 364 }; |
| 365 | 365 |
| 366 } // namespace system | 366 } // namespace system |
| 367 } // namespace mojo | 367 } // namespace mojo |
| 368 | 368 |
| 369 #endif // MOJO_SYSTEM_DISPATCHER_H_ | 369 #endif // MOJO_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |