| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 mojo::ScopedInterfaceEndpointHandle handle) { | 422 mojo::ScopedInterfaceEndpointHandle handle) { |
| 423 if (!channel_) | 423 if (!channel_) |
| 424 return; | 424 return; |
| 425 Channel::AssociatedInterfaceSupport* associated_interface_support = | 425 Channel::AssociatedInterfaceSupport* associated_interface_support = |
| 426 channel_->GetAssociatedInterfaceSupport(); | 426 channel_->GetAssociatedInterfaceSupport(); |
| 427 DCHECK(associated_interface_support); | 427 DCHECK(associated_interface_support); |
| 428 associated_interface_support->GetGenericRemoteAssociatedInterface( | 428 associated_interface_support->GetGenericRemoteAssociatedInterface( |
| 429 name, std::move(handle)); | 429 name, std::move(handle)); |
| 430 } | 430 } |
| 431 | 431 |
| 432 // Called on the IPC::Channel thread |
| 433 void ChannelProxy::Context::SendEventToSignal( |
| 434 mojo::common::mojom::EventPtr event) { |
| 435 if (channel_) |
| 436 channel_->SendEventToSignal(std::move(event)); |
| 437 } |
| 438 |
| 432 //----------------------------------------------------------------------------- | 439 //----------------------------------------------------------------------------- |
| 433 | 440 |
| 434 // static | 441 // static |
| 435 std::unique_ptr<ChannelProxy> ChannelProxy::Create( | 442 std::unique_ptr<ChannelProxy> ChannelProxy::Create( |
| 436 const IPC::ChannelHandle& channel_handle, | 443 const IPC::ChannelHandle& channel_handle, |
| 437 Channel::Mode mode, | 444 Channel::Mode mode, |
| 438 Listener* listener, | 445 Listener* listener, |
| 439 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { | 446 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { |
| 440 std::unique_ptr<ChannelProxy> channel( | 447 std::unique_ptr<ChannelProxy> channel( |
| 441 new ChannelProxy(listener, ipc_task_runner)); | 448 new ChannelProxy(listener, ipc_task_runner)); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 } | 584 } |
| 578 | 585 |
| 579 void ChannelProxy::RemoveFilter(MessageFilter* filter) { | 586 void ChannelProxy::RemoveFilter(MessageFilter* filter) { |
| 580 DCHECK(CalledOnValidThread()); | 587 DCHECK(CalledOnValidThread()); |
| 581 | 588 |
| 582 context_->ipc_task_runner()->PostTask( | 589 context_->ipc_task_runner()->PostTask( |
| 583 FROM_HERE, base::Bind(&Context::OnRemoveFilter, context_, | 590 FROM_HERE, base::Bind(&Context::OnRemoveFilter, context_, |
| 584 base::RetainedRef(filter))); | 591 base::RetainedRef(filter))); |
| 585 } | 592 } |
| 586 | 593 |
| 594 mojo::common::mojom::EventRequest ChannelProxy::CreateSynchronizationEvent() { |
| 595 mojo::common::mojom::EventPtr event; |
| 596 mojo::common::mojom::EventRequest request = mojo::GetProxy(&event); |
| 597 context_->ipc_task_runner()->PostTask( |
| 598 FROM_HERE, |
| 599 base::Bind(&Context::SendEventToSignal, context_, base::Passed(&event))); |
| 600 return request; |
| 601 } |
| 602 |
| 587 void ChannelProxy::AddGenericAssociatedInterface( | 603 void ChannelProxy::AddGenericAssociatedInterface( |
| 588 const std::string& name, | 604 const std::string& name, |
| 589 const GenericAssociatedInterfaceFactory& factory) { | 605 const GenericAssociatedInterfaceFactory& factory) { |
| 590 context()->AddGenericAssociatedInterface(name, factory); | 606 context()->AddGenericAssociatedInterface(name, factory); |
| 591 } | 607 } |
| 592 | 608 |
| 593 void ChannelProxy::AddGenericAssociatedInterfaceForIOThread( | 609 void ChannelProxy::AddGenericAssociatedInterfaceForIOThread( |
| 594 const std::string& name, | 610 const std::string& name, |
| 595 const GenericAssociatedInterfaceFactory& factory) { | 611 const GenericAssociatedInterfaceFactory& factory) { |
| 596 context()->AddGenericAssociatedInterfaceForIOThread(name, factory); | 612 context()->AddGenericAssociatedInterfaceForIOThread(name, factory); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 return channel->TakeClientFileDescriptor(); | 662 return channel->TakeClientFileDescriptor(); |
| 647 } | 663 } |
| 648 #endif | 664 #endif |
| 649 | 665 |
| 650 void ChannelProxy::OnChannelInit() { | 666 void ChannelProxy::OnChannelInit() { |
| 651 } | 667 } |
| 652 | 668 |
| 653 //----------------------------------------------------------------------------- | 669 //----------------------------------------------------------------------------- |
| 654 | 670 |
| 655 } // namespace IPC | 671 } // namespace IPC |
| OLD | NEW |