| 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 | |
| 29 namespace IPC { | 25 namespace IPC { |
| 30 class MessageFilter; | 26 class MessageFilter; |
| 31 } | 27 } |
| 32 | 28 |
| 33 namespace content { | 29 namespace content { |
| 34 class ChildProcessHostDelegate; | 30 class ChildProcessHostDelegate; |
| 35 | 31 |
| 36 // Provides common functionality for hosting a child process and processing IPC | 32 // Provides common functionality for hosting a child process and processing IPC |
| 37 // messages between the host and the child process. Users are responsible | 33 // messages between the host and the child process. Users are responsible |
| 38 // for the actual launching and terminating of the child processes. | 34 // for the actual launching and terminating of the child processes. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // IPC::Listener methods: | 71 // IPC::Listener methods: |
| 76 virtual bool OnMessageReceived(const IPC::Message& msg) override; | 72 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
| 77 virtual void OnChannelConnected(int32 peer_pid) override; | 73 virtual void OnChannelConnected(int32 peer_pid) override; |
| 78 virtual void OnChannelError() override; | 74 virtual void OnChannelError() override; |
| 79 virtual void OnBadMessageReceived(const IPC::Message& message) override; | 75 virtual void OnBadMessageReceived(const IPC::Message& message) override; |
| 80 | 76 |
| 81 // Message handlers: | 77 // Message handlers: |
| 82 void OnShutdownRequest(); | 78 void OnShutdownRequest(); |
| 83 void OnAllocateSharedMemory(uint32 buffer_size, | 79 void OnAllocateSharedMemory(uint32 buffer_size, |
| 84 base::SharedMemoryHandle* handle); | 80 base::SharedMemoryHandle* handle); |
| 85 void OnAllocateGpuMemoryBuffer(uint32 width, | |
| 86 uint32 height, | |
| 87 uint32 internalformat, | |
| 88 uint32 usage, | |
| 89 gfx::GpuMemoryBufferHandle* handle); | |
| 90 | 81 |
| 91 ChildProcessHostDelegate* delegate_; | 82 ChildProcessHostDelegate* delegate_; |
| 92 base::ProcessHandle peer_handle_; | 83 base::ProcessHandle peer_handle_; |
| 93 bool opening_channel_; // True while we're waiting the channel to be opened. | 84 bool opening_channel_; // True while we're waiting the channel to be opened. |
| 94 scoped_ptr<IPC::Channel> channel_; | 85 scoped_ptr<IPC::Channel> channel_; |
| 95 std::string channel_id_; | 86 std::string channel_id_; |
| 96 | 87 |
| 97 // Holds all the IPC message filters. Since this object lives on the IO | 88 // Holds all the IPC message filters. Since this object lives on the IO |
| 98 // thread, we don't have a IPC::ChannelProxy and so we manage filters | 89 // thread, we don't have a IPC::ChannelProxy and so we manage filters |
| 99 // manually. | 90 // manually. |
| 100 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; | 91 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; |
| 101 | 92 |
| 102 DISALLOW_COPY_AND_ASSIGN(ChildProcessHostImpl); | 93 DISALLOW_COPY_AND_ASSIGN(ChildProcessHostImpl); |
| 103 }; | 94 }; |
| 104 | 95 |
| 105 } // namespace content | 96 } // namespace content |
| 106 | 97 |
| 107 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ | 98 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |