[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / ipc / ipc_channel_common.cc
1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/task/single_thread_task_runner.h"
6 #include "build/build_config.h"
7 #include "ipc/ipc_channel.h"
8 #include "ipc/ipc_channel_mojo.h"
9 #include "mojo/public/cpp/system/message_pipe.h"
10
11 namespace IPC {
12
13 #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
14
15 namespace {
16 int g_global_pid = 0;
17 }
18
19 // static
20 void Channel::SetGlobalPid(int pid) {
21   g_global_pid = pid;
22 }
23
24 // static
25 int Channel::GetGlobalPid() {
26   return g_global_pid;
27 }
28
29 #endif  // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
30
31 // static
32 std::unique_ptr<Channel> Channel::CreateClient(
33     const IPC::ChannelHandle& channel_handle,
34     Listener* listener,
35     const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
36 #if BUILDFLAG(IS_NACL)
37   return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener);
38 #else
39   DCHECK(channel_handle.is_mojo_channel_handle());
40   return ChannelMojo::Create(
41       mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
42       Channel::MODE_CLIENT, listener, ipc_task_runner,
43       base::SingleThreadTaskRunner::GetCurrentDefault());
44 #endif
45 }
46
47 // static
48 std::unique_ptr<Channel> Channel::CreateServer(
49     const IPC::ChannelHandle& channel_handle,
50     Listener* listener,
51     const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
52 #if BUILDFLAG(IS_NACL)
53   return Channel::Create(channel_handle, Channel::MODE_SERVER, listener);
54 #else
55   DCHECK(channel_handle.is_mojo_channel_handle());
56   return ChannelMojo::Create(
57       mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
58       Channel::MODE_SERVER, listener, ipc_task_runner,
59       base::SingleThreadTaskRunner::GetCurrentDefault());
60 #endif
61 }
62
63 Channel::~Channel() = default;
64
65 Channel::AssociatedInterfaceSupport* Channel::GetAssociatedInterfaceSupport() {
66   return nullptr;
67 }
68
69 void Channel::Pause() { NOTREACHED(); }
70
71 void Channel::Unpause(bool flush) { NOTREACHED(); }
72
73 void Channel::Flush() { NOTREACHED(); }
74
75 void Channel::WillConnect() {
76   did_start_connect_ = true;
77 }
78
79 }  // namespace IPC