| Index: ppapi/nacl_irt/manifest_service.cc
|
| diff --git a/ppapi/nacl_irt/manifest_service.cc b/ppapi/nacl_irt/manifest_service.cc
|
| index 8a6ec1f641835bae0181f12acb432585a3a8ad62..b98dd3832c850b6200ffc6f141b3a5a7bc908c61 100644
|
| --- a/ppapi/nacl_irt/manifest_service.cc
|
| +++ b/ppapi/nacl_irt/manifest_service.cc
|
| @@ -6,7 +6,7 @@
|
|
|
| #include "base/single_thread_task_runner.h"
|
| #include "ipc/ipc_channel_handle.h"
|
| -#include "ipc/ipc_channel_proxy.h"
|
| +#include "ipc/ipc_sync_channel.h"
|
| #include "ipc/ipc_sync_message_filter.h"
|
| #include "native_client/src/trusted/service_runtime/include/sys/errno.h"
|
| #include "ppapi/nacl_irt/irt_manifest.h"
|
| @@ -21,58 +21,16 @@
|
|
|
| namespace ppapi {
|
|
|
| -// IPC channel is asynchronously set up. So, the NaCl process may try to
|
| -// send a OpenResource message to the host before the connection is
|
| -// established. In such a case, it is necessary to wait for the set up
|
| -// completion.
|
| -class ManifestMessageFilter : public IPC::SyncMessageFilter {
|
| - public:
|
| - ManifestMessageFilter(base::WaitableEvent* shutdown_event)
|
| - : SyncMessageFilter(shutdown_event),
|
| - connected_event_(
|
| - true /* manual_reset */, false /* initially_signaled */) {
|
| - }
|
| -
|
| - bool Send(IPC::Message* message) override {
|
| - // Wait until set up is actually done.
|
| - connected_event_.Wait();
|
| - return SyncMessageFilter::Send(message);
|
| - }
|
| -
|
| - // When set up is done, OnFilterAdded is called on IO thread. Unblocks the
|
| - // Send().
|
| - void OnFilterAdded(IPC::Sender* sender) override {
|
| - SyncMessageFilter::OnFilterAdded(sender);
|
| - connected_event_.Signal();
|
| - }
|
| -
|
| - // If an error is found, unblocks the Send(), too, to return an error.
|
| - void OnChannelError() override {
|
| - SyncMessageFilter::OnChannelError();
|
| - connected_event_.Signal();
|
| - }
|
| -
|
| - // Similar to OnChannelError, unblocks the Send() on the channel closing.
|
| - void OnChannelClosing() override {
|
| - SyncMessageFilter::OnChannelClosing();
|
| - connected_event_.Signal();
|
| - }
|
| -
|
| - private:
|
| - base::WaitableEvent connected_event_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(ManifestMessageFilter);
|
| -};
|
| -
|
| ManifestService::ManifestService(
|
| const IPC::ChannelHandle& handle,
|
| scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
|
| base::WaitableEvent* shutdown_event) {
|
| - filter_ = new ManifestMessageFilter(shutdown_event);
|
| - channel_ = IPC::ChannelProxy::Create(handle, IPC::Channel::MODE_SERVER,
|
| - NULL, // Listener
|
| - io_task_runner.get());
|
| - channel_->AddFilter(filter_.get());
|
| + channel_ = IPC::SyncChannel::Create(handle, IPC::Channel::MODE_SERVER,
|
| + nullptr /* listener */,
|
| + io_task_runner.get(),
|
| + false /* create_pipe_now */,
|
| + shutdown_event);
|
| + filter_ = channel_->AddNewSyncMessageFilter();
|
| }
|
|
|
| ManifestService::~ManifestService() {
|
|
|