| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_NODE_CONTROLLER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_ |
| 6 #define MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_ | 6 #define MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // The name of our broker node, if any. | 268 // The name of our broker node, if any. |
| 269 ports::NodeName broker_name_; | 269 ports::NodeName broker_name_; |
| 270 | 270 |
| 271 // A queue of pending child names waiting to be connected to a broker. | 271 // A queue of pending child names waiting to be connected to a broker. |
| 272 std::queue<ports::NodeName> pending_broker_clients_; | 272 std::queue<ports::NodeName> pending_broker_clients_; |
| 273 | 273 |
| 274 // Messages waiting to be relayed by the broker once it's known. | 274 // Messages waiting to be relayed by the broker once it's known. |
| 275 std::unordered_map<ports::NodeName, OutgoingMessageQueue> | 275 std::unordered_map<ports::NodeName, OutgoingMessageQueue> |
| 276 pending_relay_messages_; | 276 pending_relay_messages_; |
| 277 | 277 |
| 278 // Guards |incoming_messages_|. | 278 // Guards |incoming_messages_| and |incoming_messages_task_posted_|. |
| 279 base::Lock messages_lock_; | 279 base::Lock messages_lock_; |
| 280 std::queue<ports::ScopedMessage> incoming_messages_; | 280 std::queue<ports::ScopedMessage> incoming_messages_; |
| 281 // Ensures that there is only one incoming messages task posted to the IO |
| 282 // thread. |
| 283 bool incoming_messages_task_posted_ = false; |
| 281 // Flag to fast-path checking |incoming_messages_|. | 284 // Flag to fast-path checking |incoming_messages_|. |
| 282 AtomicFlag incoming_messages_flag_; | 285 AtomicFlag incoming_messages_flag_; |
| 283 | 286 |
| 284 // Guards |shutdown_callback_|. | 287 // Guards |shutdown_callback_|. |
| 285 base::Lock shutdown_lock_; | 288 base::Lock shutdown_lock_; |
| 286 | 289 |
| 287 // Set by RequestShutdown(). If this is non-null, the controller will | 290 // Set by RequestShutdown(). If this is non-null, the controller will |
| 288 // begin polling the Node to see if clean shutdown is possible any time the | 291 // begin polling the Node to see if clean shutdown is possible any time the |
| 289 // Node's state is modified by the controller. | 292 // Node's state is modified by the controller. |
| 290 base::Closure shutdown_callback_; | 293 base::Closure shutdown_callback_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 312 std::unique_ptr<MachPortRelay> mach_port_relay_; | 315 std::unique_ptr<MachPortRelay> mach_port_relay_; |
| 313 #endif | 316 #endif |
| 314 | 317 |
| 315 DISALLOW_COPY_AND_ASSIGN(NodeController); | 318 DISALLOW_COPY_AND_ASSIGN(NodeController); |
| 316 }; | 319 }; |
| 317 | 320 |
| 318 } // namespace edk | 321 } // namespace edk |
| 319 } // namespace mojo | 322 } // namespace mojo |
| 320 | 323 |
| 321 #endif // MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_ | 324 #endif // MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_ |
| OLD | NEW |