| 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 #include "mojo/edk/system/slave_connection_manager.h" | 5 #include "mojo/edk/system/slave_connection_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "mojo/edk/system/connection_manager_messages.h" | 14 #include "mojo/edk/system/connection_manager_messages.h" |
| 15 #include "mojo/edk/system/message_in_transit.h" | 15 #include "mojo/edk/system/message_in_transit.h" |
| 16 #include "mojo/edk/util/make_unique.h" | 16 #include "mojo/edk/util/make_unique.h" |
| 17 | 17 |
| 18 using mojo::platform::TaskRunner; |
| 18 using mojo::util::MutexLocker; | 19 using mojo::util::MutexLocker; |
| 19 using mojo::util::RefPtr; | 20 using mojo::util::RefPtr; |
| 20 | 21 |
| 21 namespace mojo { | 22 namespace mojo { |
| 22 namespace system { | 23 namespace system { |
| 23 | 24 |
| 24 // SlaveConnectionManager ------------------------------------------------------ | 25 // SlaveConnectionManager ------------------------------------------------------ |
| 25 | 26 |
| 26 SlaveConnectionManager::SlaveConnectionManager( | 27 SlaveConnectionManager::SlaveConnectionManager( |
| 27 embedder::PlatformSupport* platform_support) | 28 embedder::PlatformSupport* platform_support) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 DCHECK(!slave_process_delegate_); | 40 DCHECK(!slave_process_delegate_); |
| 40 DCHECK(!private_thread_.message_loop()); | 41 DCHECK(!private_thread_.message_loop()); |
| 41 DCHECK_EQ(awaiting_ack_type_, NOT_AWAITING_ACK); | 42 DCHECK_EQ(awaiting_ack_type_, NOT_AWAITING_ACK); |
| 42 DCHECK(!ack_result_); | 43 DCHECK(!ack_result_); |
| 43 DCHECK(!ack_peer_process_identifier_); | 44 DCHECK(!ack_peer_process_identifier_); |
| 44 DCHECK(!ack_is_first_); | 45 DCHECK(!ack_is_first_); |
| 45 DCHECK(!ack_platform_handle_); | 46 DCHECK(!ack_platform_handle_); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void SlaveConnectionManager::Init( | 49 void SlaveConnectionManager::Init( |
| 49 RefPtr<embedder::PlatformTaskRunner>&& delegate_thread_task_runner, | 50 RefPtr<TaskRunner>&& delegate_thread_task_runner, |
| 50 embedder::SlaveProcessDelegate* slave_process_delegate, | 51 embedder::SlaveProcessDelegate* slave_process_delegate, |
| 51 embedder::ScopedPlatformHandle platform_handle) { | 52 embedder::ScopedPlatformHandle platform_handle) { |
| 52 DCHECK(delegate_thread_task_runner); | 53 DCHECK(delegate_thread_task_runner); |
| 53 DCHECK(slave_process_delegate); | 54 DCHECK(slave_process_delegate); |
| 54 DCHECK(platform_handle.is_valid()); | 55 DCHECK(platform_handle.is_valid()); |
| 55 DCHECK(!delegate_thread_task_runner_); | 56 DCHECK(!delegate_thread_task_runner_); |
| 56 DCHECK(!slave_process_delegate_); | 57 DCHECK(!slave_process_delegate_); |
| 57 DCHECK(!private_thread_.message_loop()); | 58 DCHECK(!private_thread_.message_loop()); |
| 58 | 59 |
| 59 delegate_thread_task_runner_ = std::move(delegate_thread_task_runner); | 60 delegate_thread_task_runner_ = std::move(delegate_thread_task_runner); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 340 } |
| 340 | 341 |
| 341 void SlaveConnectionManager::AssertOnPrivateThread() const { | 342 void SlaveConnectionManager::AssertOnPrivateThread() const { |
| 342 // This should only be called after |Init()| and before |Shutdown()|. | 343 // This should only be called after |Init()| and before |Shutdown()|. |
| 343 DCHECK(private_thread_.message_loop()); | 344 DCHECK(private_thread_.message_loop()); |
| 344 DCHECK_EQ(base::MessageLoop::current(), private_thread_.message_loop()); | 345 DCHECK_EQ(base::MessageLoop::current(), private_thread_.message_loop()); |
| 345 } | 346 } |
| 346 | 347 |
| 347 } // namespace system | 348 } // namespace system |
| 348 } // namespace mojo | 349 } // namespace mojo |
| OLD | NEW |