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 #ifndef CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ |
6 #define CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
18 #include "content/public/common/child_process_host.h" | 18 #include "content/public/common/child_process_host.h" |
19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class FilePath; | 22 class FilePath; |
23 } | 23 } |
24 | 24 |
| 25 namespace gfx { |
| 26 struct GpuMemoryBufferHandle; |
| 27 } |
| 28 |
25 namespace content { | 29 namespace content { |
26 class ChildProcessHostDelegate; | 30 class ChildProcessHostDelegate; |
27 | 31 |
28 // Provides common functionality for hosting a child process and processing IPC | 32 // Provides common functionality for hosting a child process and processing IPC |
29 // messages between the host and the child process. Users are responsible | 33 // messages between the host and the child process. Users are responsible |
30 // for the actual launching and terminating of the child processes. | 34 // for the actual launching and terminating of the child processes. |
31 class CONTENT_EXPORT ChildProcessHostImpl : public ChildProcessHost, | 35 class CONTENT_EXPORT ChildProcessHostImpl : public ChildProcessHost, |
32 public IPC::Listener { | 36 public IPC::Listener { |
33 public: | 37 public: |
34 virtual ~ChildProcessHostImpl(); | 38 virtual ~ChildProcessHostImpl(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 72 |
69 // IPC::Listener methods: | 73 // IPC::Listener methods: |
70 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
71 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 75 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
72 virtual void OnChannelError() OVERRIDE; | 76 virtual void OnChannelError() OVERRIDE; |
73 | 77 |
74 // Message handlers: | 78 // Message handlers: |
75 void OnShutdownRequest(); | 79 void OnShutdownRequest(); |
76 void OnAllocateSharedMemory(uint32 buffer_size, | 80 void OnAllocateSharedMemory(uint32 buffer_size, |
77 base::SharedMemoryHandle* handle); | 81 base::SharedMemoryHandle* handle); |
| 82 void OnAllocateGpuMemoryBuffer(uint32 buffer_size, |
| 83 gfx::GpuMemoryBufferHandle* handle); |
78 | 84 |
79 ChildProcessHostDelegate* delegate_; | 85 ChildProcessHostDelegate* delegate_; |
80 base::ProcessHandle peer_handle_; | 86 base::ProcessHandle peer_handle_; |
81 bool opening_channel_; // True while we're waiting the channel to be opened. | 87 bool opening_channel_; // True while we're waiting the channel to be opened. |
82 scoped_ptr<IPC::Channel> channel_; | 88 scoped_ptr<IPC::Channel> channel_; |
83 std::string channel_id_; | 89 std::string channel_id_; |
84 | 90 |
85 // Holds all the IPC message filters. Since this object lives on the IO | 91 // Holds all the IPC message filters. Since this object lives on the IO |
86 // thread, we don't have a IPC::ChannelProxy and so we manage filters | 92 // thread, we don't have a IPC::ChannelProxy and so we manage filters |
87 // manually. | 93 // manually. |
88 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; | 94 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; |
89 | 95 |
90 DISALLOW_COPY_AND_ASSIGN(ChildProcessHostImpl); | 96 DISALLOW_COPY_AND_ASSIGN(ChildProcessHostImpl); |
91 }; | 97 }; |
92 | 98 |
93 } // namespace content | 99 } // namespace content |
94 | 100 |
95 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ | 101 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ |
OLD | NEW |