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 "ipc/ipc_channel_proxy.h" | 5 #include "ipc/ipc_channel_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 if (filters_[i].get() == filter) { | 227 if (filters_[i].get() == filter) { |
228 filter->OnFilterRemoved(); | 228 filter->OnFilterRemoved(); |
229 filters_.erase(filters_.begin() + i); | 229 filters_.erase(filters_.begin() + i); |
230 return; | 230 return; |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 NOTREACHED() << "filter to be removed not found"; | 234 NOTREACHED() << "filter to be removed not found"; |
235 } | 235 } |
236 | 236 |
| 237 void ChannelProxy::Context::OnClientLaunched(base::ProcessHandle handle) { |
| 238 channel_->OnClientLaunched(handle); |
| 239 } |
| 240 |
237 // Called on the listener's thread | 241 // Called on the listener's thread |
238 void ChannelProxy::Context::AddFilter(MessageFilter* filter) { | 242 void ChannelProxy::Context::AddFilter(MessageFilter* filter) { |
239 base::AutoLock auto_lock(pending_filters_lock_); | 243 base::AutoLock auto_lock(pending_filters_lock_); |
240 pending_filters_.push_back(make_scoped_refptr(filter)); | 244 pending_filters_.push_back(make_scoped_refptr(filter)); |
241 ipc_task_runner_->PostTask( | 245 ipc_task_runner_->PostTask( |
242 FROM_HERE, base::Bind(&Context::OnAddFilter, this)); | 246 FROM_HERE, base::Bind(&Context::OnAddFilter, this)); |
243 } | 247 } |
244 | 248 |
245 // Called on the listener's thread | 249 // Called on the listener's thread |
246 void ChannelProxy::Context::OnDispatchMessage(const Message& message) { | 250 void ChannelProxy::Context::OnDispatchMessage(const Message& message) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 FROM_HERE, base::Bind(&Context::OnRemoveFilter, context_.get(), | 431 FROM_HERE, base::Bind(&Context::OnRemoveFilter, context_.get(), |
428 make_scoped_refptr(filter))); | 432 make_scoped_refptr(filter))); |
429 } | 433 } |
430 | 434 |
431 void ChannelProxy::ClearIPCTaskRunner() { | 435 void ChannelProxy::ClearIPCTaskRunner() { |
432 DCHECK(CalledOnValidThread()); | 436 DCHECK(CalledOnValidThread()); |
433 | 437 |
434 context()->ClearIPCTaskRunner(); | 438 context()->ClearIPCTaskRunner(); |
435 } | 439 } |
436 | 440 |
| 441 void ChannelProxy::OnClientLaunched(base::ProcessHandle handle) { |
| 442 context_->ipc_task_runner()->PostTask( |
| 443 FROM_HERE, |
| 444 base::Bind(&Context::OnClientLaunched, context_.get(), handle)); |
| 445 } |
| 446 |
437 #if defined(OS_POSIX) && !defined(OS_NACL) | 447 #if defined(OS_POSIX) && !defined(OS_NACL) |
438 // See the TODO regarding lazy initialization of the channel in | 448 // See the TODO regarding lazy initialization of the channel in |
439 // ChannelProxy::Init(). | 449 // ChannelProxy::Init(). |
440 int ChannelProxy::GetClientFileDescriptor() { | 450 int ChannelProxy::GetClientFileDescriptor() { |
441 DCHECK(CalledOnValidThread()); | 451 DCHECK(CalledOnValidThread()); |
442 | 452 |
443 Channel* channel = context_.get()->channel_.get(); | 453 Channel* channel = context_.get()->channel_.get(); |
444 // Channel must have been created first. | 454 // Channel must have been created first. |
445 DCHECK(channel) << context_.get()->channel_id_; | 455 DCHECK(channel) << context_.get()->channel_id_; |
446 return channel->GetClientFileDescriptor(); | 456 return channel->GetClientFileDescriptor(); |
447 } | 457 } |
448 | 458 |
449 int ChannelProxy::TakeClientFileDescriptor() { | 459 int ChannelProxy::TakeClientFileDescriptor() { |
450 DCHECK(CalledOnValidThread()); | 460 DCHECK(CalledOnValidThread()); |
451 | 461 |
452 Channel* channel = context_.get()->channel_.get(); | 462 Channel* channel = context_.get()->channel_.get(); |
453 // Channel must have been created first. | 463 // Channel must have been created first. |
454 DCHECK(channel) << context_.get()->channel_id_; | 464 DCHECK(channel) << context_.get()->channel_id_; |
455 return channel->TakeClientFileDescriptor(); | 465 return channel->TakeClientFileDescriptor(); |
456 } | 466 } |
457 #endif | 467 #endif |
458 | 468 |
459 //----------------------------------------------------------------------------- | 469 //----------------------------------------------------------------------------- |
460 | 470 |
461 } // namespace IPC | 471 } // namespace IPC |
OLD | NEW |