OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
7 #include "ipc/ipc_channel_factory.h" | 7 #include "ipc/ipc_channel_factory.h" |
8 #include "ipc/ipc_channel_mojo.h" | 8 #include "ipc/ipc_channel_mojo.h" |
9 | 9 |
10 namespace IPC { | 10 namespace IPC { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class PlatformChannelFactory : public ChannelFactory { | 14 class PlatformChannelFactory : public ChannelFactory { |
15 public: | 15 public: |
16 PlatformChannelFactory( | 16 PlatformChannelFactory( |
17 ChannelHandle handle, | 17 ChannelHandle handle, |
18 Channel::Mode mode, | 18 Channel::Mode mode, |
19 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) | 19 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) |
20 : handle_(handle), mode_(mode), ipc_task_runner_(ipc_task_runner) {} | 20 : handle_(handle), mode_(mode), ipc_task_runner_(ipc_task_runner) {} |
21 | 21 |
22 std::string GetName() const override { return ""; } | |
23 | |
24 std::unique_ptr<Channel> BuildChannel(Listener* listener) override { | 22 std::unique_ptr<Channel> BuildChannel(Listener* listener) override { |
25 #if defined(OS_NACL_SFI) | 23 #if defined(OS_NACL_SFI) |
26 return Channel::Create(handle_, mode_, listener); | 24 return Channel::Create(handle_, mode_, listener); |
27 #else | 25 #else |
28 DCHECK(handle_.is_mojo_channel_handle()); | 26 DCHECK(handle_.is_mojo_channel_handle()); |
29 return ChannelMojo::Create( | 27 return ChannelMojo::Create( |
30 mojo::ScopedMessagePipeHandle(handle_.mojo_handle), mode_, listener, | 28 mojo::ScopedMessagePipeHandle(handle_.mojo_handle), mode_, listener, |
31 ipc_task_runner_); | 29 ipc_task_runner_); |
32 #endif | 30 #endif |
33 } | 31 } |
(...skipping 15 matching lines...) Expand all Loading... |
49 // static | 47 // static |
50 std::unique_ptr<ChannelFactory> ChannelFactory::Create( | 48 std::unique_ptr<ChannelFactory> ChannelFactory::Create( |
51 const ChannelHandle& handle, | 49 const ChannelHandle& handle, |
52 Channel::Mode mode, | 50 Channel::Mode mode, |
53 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { | 51 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { |
54 return base::MakeUnique<PlatformChannelFactory>(handle, mode, | 52 return base::MakeUnique<PlatformChannelFactory>(handle, mode, |
55 ipc_task_runner); | 53 ipc_task_runner); |
56 } | 54 } |
57 | 55 |
58 } // namespace IPC | 56 } // namespace IPC |
OLD | NEW |