| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 ChannelProxy::Context::Context(Listener* listener, | 139 ChannelProxy::Context::Context(Listener* listener, |
| 140 base::SingleThreadTaskRunner* ipc_task_runner) | 140 base::SingleThreadTaskRunner* ipc_task_runner) |
| 141 : listener_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 141 : listener_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 142 listener_(listener), | 142 listener_(listener), |
| 143 ipc_task_runner_(ipc_task_runner), | 143 ipc_task_runner_(ipc_task_runner), |
| 144 channel_connected_called_(false), | 144 channel_connected_called_(false), |
| 145 message_filter_router_(new MessageFilterRouter()), | 145 message_filter_router_(new MessageFilterRouter()), |
| 146 peer_pid_(base::kNullProcessId) { | 146 peer_pid_(base::kNullProcessId) { |
| 147 DCHECK(ipc_task_runner_.get()); | 147 DCHECK(ipc_task_runner_.get()); |
| 148 // The Listener thread where Messages are handled must be a separate thread |
| 149 // to avoid oversubscribing the IO thread. If you trigger this error, you |
| 150 // need to either: |
| 151 // 1) Create the ChannelProxy on a different thread, or |
| 152 // 2) Just use Channel |
| 153 // Note, we currently make an exception for a NULL listener. That usage |
| 154 // basically works, but is outside the intent of ChannelProxy. This support |
| 155 // will disappear, so please don't rely on it. See crbug.com/364241 |
| 156 DCHECK(!listener || (ipc_task_runner_.get() != listener_task_runner_.get())); |
| 148 } | 157 } |
| 149 | 158 |
| 150 ChannelProxy::Context::~Context() { | 159 ChannelProxy::Context::~Context() { |
| 151 } | 160 } |
| 152 | 161 |
| 153 void ChannelProxy::Context::ClearIPCTaskRunner() { | 162 void ChannelProxy::Context::ClearIPCTaskRunner() { |
| 154 ipc_task_runner_ = NULL; | 163 ipc_task_runner_ = NULL; |
| 155 } | 164 } |
| 156 | 165 |
| 157 void ChannelProxy::Context::CreateChannel(const IPC::ChannelHandle& handle, | 166 void ChannelProxy::Context::CreateChannel(const IPC::ChannelHandle& handle, |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 Channel* channel = context_.get()->channel_.get(); | 539 Channel* channel = context_.get()->channel_.get(); |
| 531 // Channel must have been created first. | 540 // Channel must have been created first. |
| 532 DCHECK(channel) << context_.get()->channel_id_; | 541 DCHECK(channel) << context_.get()->channel_id_; |
| 533 return channel->GetPeerEuid(peer_euid); | 542 return channel->GetPeerEuid(peer_euid); |
| 534 } | 543 } |
| 535 #endif | 544 #endif |
| 536 | 545 |
| 537 //----------------------------------------------------------------------------- | 546 //----------------------------------------------------------------------------- |
| 538 | 547 |
| 539 } // namespace IPC | 548 } // namespace IPC |
| OLD | NEW |