| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/shared_memory.h" | 16 #include "base/memory/shared_memory.h" |
| 17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 18 #include "base/process/process.h" | 18 #include "base/process/process.h" |
| 19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "content/public/common/child_process_host.h" | 21 #include "content/public/common/child_process_host.h" |
| 22 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
| 23 #include "ui/gfx/gpu_memory_buffer.h" | |
| 24 | 23 |
| 25 namespace IPC { | 24 namespace IPC { |
| 26 class MessageFilter; | 25 class MessageFilter; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace gpu { | 28 namespace gpu { |
| 30 struct SyncToken; | 29 struct SyncToken; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace content { | 32 namespace content { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 explicit ChildProcessHostImpl(ChildProcessHostDelegate* delegate); | 80 explicit ChildProcessHostImpl(ChildProcessHostDelegate* delegate); |
| 82 | 81 |
| 83 // IPC::Listener methods: | 82 // IPC::Listener methods: |
| 84 bool OnMessageReceived(const IPC::Message& msg) override; | 83 bool OnMessageReceived(const IPC::Message& msg) override; |
| 85 void OnChannelConnected(int32_t peer_pid) override; | 84 void OnChannelConnected(int32_t peer_pid) override; |
| 86 void OnChannelError() override; | 85 void OnChannelError() override; |
| 87 void OnBadMessageReceived(const IPC::Message& message) override; | 86 void OnBadMessageReceived(const IPC::Message& message) override; |
| 88 | 87 |
| 89 // Message handlers: | 88 // Message handlers: |
| 90 void OnShutdownRequest(); | 89 void OnShutdownRequest(); |
| 91 void OnAllocateGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | |
| 92 uint32_t width, | |
| 93 uint32_t height, | |
| 94 gfx::BufferFormat format, | |
| 95 gfx::BufferUsage usage, | |
| 96 gfx::GpuMemoryBufferHandle* handle); | |
| 97 void OnDeletedGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | |
| 98 const gpu::SyncToken& sync_token); | |
| 99 | 90 |
| 100 // Initializes the IPC channel and returns true on success. |channel_| must be | 91 // Initializes the IPC channel and returns true on success. |channel_| must be |
| 101 // non-null. | 92 // non-null. |
| 102 bool InitChannel(); | 93 bool InitChannel(); |
| 103 | 94 |
| 104 ChildProcessHostDelegate* delegate_; | 95 ChildProcessHostDelegate* delegate_; |
| 105 base::Process peer_process_; | 96 base::Process peer_process_; |
| 106 bool opening_channel_; // True while we're waiting the channel to be opened. | 97 bool opening_channel_; // True while we're waiting the channel to be opened. |
| 107 std::unique_ptr<IPC::Channel> channel_; | 98 std::unique_ptr<IPC::Channel> channel_; |
| 108 std::string channel_id_; | 99 std::string channel_id_; |
| 109 | 100 |
| 110 // Holds all the IPC message filters. Since this object lives on the IO | 101 // Holds all the IPC message filters. Since this object lives on the IO |
| 111 // thread, we don't have a IPC::ChannelProxy and so we manage filters | 102 // thread, we don't have a IPC::ChannelProxy and so we manage filters |
| 112 // manually. | 103 // manually. |
| 113 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; | 104 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; |
| 114 | 105 |
| 115 DISALLOW_COPY_AND_ASSIGN(ChildProcessHostImpl); | 106 DISALLOW_COPY_AND_ASSIGN(ChildProcessHostImpl); |
| 116 }; | 107 }; |
| 117 | 108 |
| 118 } // namespace content | 109 } // namespace content |
| 119 | 110 |
| 120 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ | 111 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |