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 #include "mojo/edk/system/broker_host.h" | 5 #include "mojo/edk/system/broker_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 BrokerHost::BrokerHost(base::ProcessHandle client_process, | 22 BrokerHost::BrokerHost(base::ProcessHandle client_process, |
23 ScopedPlatformHandle platform_handle) | 23 ScopedPlatformHandle platform_handle) |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
25 : client_process_(client_process) | 25 : client_process_(client_process) |
26 #endif | 26 #endif |
27 { | 27 { |
28 CHECK(platform_handle.is_valid()); | 28 CHECK(platform_handle.is_valid()); |
29 | 29 |
30 base::MessageLoop::current()->AddDestructionObserver(this); | 30 base::MessageLoop::current()->AddDestructionObserver(this); |
31 | 31 |
32 channel_ = Channel::Create( | 32 channel_ = Channel::Create(this, ConnectionParam(std::move(platform_handle)), |
33 this, std::move(platform_handle), base::ThreadTaskRunnerHandle::Get()); | 33 base::ThreadTaskRunnerHandle::Get()); |
34 channel_->Start(); | 34 channel_->Start(); |
35 } | 35 } |
36 | 36 |
37 BrokerHost::~BrokerHost() { | 37 BrokerHost::~BrokerHost() { |
38 // We're always destroyed on the creation thread, which is the IO thread. | 38 // We're always destroyed on the creation thread, which is the IO thread. |
39 base::MessageLoop::current()->RemoveDestructionObserver(this); | 39 base::MessageLoop::current()->RemoveDestructionObserver(this); |
40 | 40 |
41 if (channel_) | 41 if (channel_) |
42 channel_->ShutDown(); | 42 channel_->ShutDown(); |
43 } | 43 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 break; | 144 break; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 void BrokerHost::OnChannelError() { delete this; } | 148 void BrokerHost::OnChannelError() { delete this; } |
149 | 149 |
150 void BrokerHost::WillDestroyCurrentMessageLoop() { delete this; } | 150 void BrokerHost::WillDestroyCurrentMessageLoop() { delete this; } |
151 | 151 |
152 } // namespace edk | 152 } // namespace edk |
153 } // namespace mojo | 153 } // namespace mojo |
OLD | NEW |