Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: ipc/ipc_channel_factory.cc

Issue 2473993003: Delete IPC::ChannelPosix, IPC::ChannelWin and IPC::AttachmentBroker. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc_channel_common.cc ('k') | ipc/ipc_channel_mojo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 { 22 std::string GetName() const override { return ""; }
23 return handle_.name;
24 }
25 23
26 std::unique_ptr<Channel> BuildChannel(Listener* listener) override { 24 std::unique_ptr<Channel> BuildChannel(Listener* listener) override {
27 if (handle_.mojo_handle.is_valid()) { 25 #if defined(OS_NACL_SFI)
28 return ChannelMojo::Create(
29 mojo::ScopedMessagePipeHandle(handle_.mojo_handle), mode_, listener,
30 ipc_task_runner_);
31 }
32 return Channel::Create(handle_, mode_, listener); 26 return Channel::Create(handle_, mode_, listener);
27 #else
28 DCHECK(handle_.is_mojo_channel_handle());
29 return ChannelMojo::Create(
30 mojo::ScopedMessagePipeHandle(handle_.mojo_handle), mode_, listener,
31 ipc_task_runner_);
32 #endif
33 } 33 }
34 34
35 scoped_refptr<base::SingleThreadTaskRunner> GetIPCTaskRunner() override { 35 scoped_refptr<base::SingleThreadTaskRunner> GetIPCTaskRunner() override {
36 return ipc_task_runner_; 36 return ipc_task_runner_;
37 } 37 }
38 38
39 private: 39 private:
40 ChannelHandle handle_; 40 ChannelHandle handle_;
41 Channel::Mode mode_; 41 Channel::Mode mode_;
42 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; 42 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_;
43 43
44 DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory); 44 DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory);
45 }; 45 };
46 46
47 } // namespace 47 } // namespace
48 48
49 // static 49 // static
50 std::unique_ptr<ChannelFactory> ChannelFactory::Create( 50 std::unique_ptr<ChannelFactory> ChannelFactory::Create(
51 const ChannelHandle& handle, 51 const ChannelHandle& handle,
52 Channel::Mode mode, 52 Channel::Mode mode,
53 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { 53 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
54 return base::MakeUnique<PlatformChannelFactory>(handle, mode, 54 return base::MakeUnique<PlatformChannelFactory>(handle, mode,
55 ipc_task_runner); 55 ipc_task_runner);
56 } 56 }
57 57
58 } // namespace IPC 58 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_common.cc ('k') | ipc/ipc_channel_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698