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 #include "content/common/child_process_host_impl.h" | 5 #include "content/common/child_process_host_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 filters_[i]->OnChannelClosing(); | 142 filters_[i]->OnChannelClosing(); |
143 filters_[i]->OnFilterRemoved(); | 143 filters_[i]->OnFilterRemoved(); |
144 } | 144 } |
145 | 145 |
146 base::CloseProcessHandle(peer_handle_); | 146 base::CloseProcessHandle(peer_handle_); |
147 } | 147 } |
148 | 148 |
149 void ChildProcessHostImpl::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { | 149 void ChildProcessHostImpl::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { |
150 filters_.push_back(filter); | 150 filters_.push_back(filter); |
151 | 151 |
152 if (channel_.get()) | 152 if (channel_) |
153 filter->OnFilterAdded(channel_.get()); | 153 filter->OnFilterAdded(channel_.get()); |
154 } | 154 } |
155 | 155 |
156 void ChildProcessHostImpl::ForceShutdown() { | 156 void ChildProcessHostImpl::ForceShutdown() { |
157 Send(new ChildProcessMsg_Shutdown()); | 157 Send(new ChildProcessMsg_Shutdown()); |
158 } | 158 } |
159 | 159 |
160 std::string ChildProcessHostImpl::CreateChannel() { | 160 std::string ChildProcessHostImpl::CreateChannel() { |
161 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); | 161 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); |
162 channel_.reset(new IPC::Channel( | 162 channel_.reset(new IPC::Channel( |
(...skipping 19 matching lines...) Expand all Loading... |
182 return opening_channel_; | 182 return opening_channel_; |
183 } | 183 } |
184 | 184 |
185 #if defined(OS_POSIX) | 185 #if defined(OS_POSIX) |
186 int ChildProcessHostImpl::TakeClientFileDescriptor() { | 186 int ChildProcessHostImpl::TakeClientFileDescriptor() { |
187 return channel_->TakeClientFileDescriptor(); | 187 return channel_->TakeClientFileDescriptor(); |
188 } | 188 } |
189 #endif | 189 #endif |
190 | 190 |
191 bool ChildProcessHostImpl::Send(IPC::Message* message) { | 191 bool ChildProcessHostImpl::Send(IPC::Message* message) { |
192 if (!channel_.get()) { | 192 if (!channel_) { |
193 delete message; | 193 delete message; |
194 return false; | 194 return false; |
195 } | 195 } |
196 return channel_->Send(message); | 196 return channel_->Send(message); |
197 } | 197 } |
198 | 198 |
199 void ChildProcessHostImpl::AllocateSharedMemory( | 199 void ChildProcessHostImpl::AllocateSharedMemory( |
200 size_t buffer_size, base::ProcessHandle child_process_handle, | 200 size_t buffer_size, base::ProcessHandle child_process_handle, |
201 base::SharedMemoryHandle* shared_memory_handle) { | 201 base::SharedMemoryHandle* shared_memory_handle) { |
202 base::SharedMemory shared_buf; | 202 base::SharedMemory shared_buf; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 base::SharedMemoryHandle* handle) { | 287 base::SharedMemoryHandle* handle) { |
288 AllocateSharedMemory(buffer_size, peer_handle_, handle); | 288 AllocateSharedMemory(buffer_size, peer_handle_, handle); |
289 } | 289 } |
290 | 290 |
291 void ChildProcessHostImpl::OnShutdownRequest() { | 291 void ChildProcessHostImpl::OnShutdownRequest() { |
292 if (delegate_->CanShutdown()) | 292 if (delegate_->CanShutdown()) |
293 Send(new ChildProcessMsg_Shutdown()); | 293 Send(new ChildProcessMsg_Shutdown()); |
294 } | 294 } |
295 | 295 |
296 } // namespace content | 296 } // namespace content |
OLD | NEW |