Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(917)

Side by Side Diff: content/common/child_process_host_impl.cc

Issue 2058653002: Ignore kill termination status when shutting down a child process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/child_process_host_impl.h ('k') | content/public/common/child_process_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 // On most platforms, the child executable is the same as the current 79 // On most platforms, the child executable is the same as the current
80 // executable. 80 // executable.
81 if (child_path.empty()) 81 if (child_path.empty())
82 PathService::Get(CHILD_PROCESS_EXE, &child_path); 82 PathService::Get(CHILD_PROCESS_EXE, &child_path);
83 return child_path; 83 return child_path;
84 } 84 }
85 85
86 ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate) 86 ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate)
87 : delegate_(delegate), 87 : delegate_(delegate),
88 opening_channel_(false) { 88 opening_channel_(false),
89 is_shutting_down_(false) {
89 #if defined(OS_WIN) 90 #if defined(OS_WIN)
90 AddFilter(new FontCacheDispatcher()); 91 AddFilter(new FontCacheDispatcher());
91 #endif 92 #endif
92 93
93 #if USE_ATTACHMENT_BROKER 94 #if USE_ATTACHMENT_BROKER
94 #if defined(OS_MACOSX) 95 #if defined(OS_MACOSX)
95 // On Mac, the privileged AttachmentBroker needs a reference to the Mach port 96 // On Mac, the privileged AttachmentBroker needs a reference to the Mach port
96 // Provider, which is only available in the chrome/ module. The attachment 97 // Provider, which is only available in the chrome/ module. The attachment
97 // broker must already be created. 98 // broker must already be created.
98 DCHECK(IPC::AttachmentBroker::GetGlobal()); 99 DCHECK(IPC::AttachmentBroker::GetGlobal());
(...skipping 24 matching lines...) Expand all
123 124
124 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) { 125 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) {
125 filters_.push_back(filter); 126 filters_.push_back(filter);
126 127
127 if (channel_) 128 if (channel_)
128 filter->OnFilterAdded(channel_.get()); 129 filter->OnFilterAdded(channel_.get());
129 } 130 }
130 131
131 void ChildProcessHostImpl::ForceShutdown() { 132 void ChildProcessHostImpl::ForceShutdown() {
132 Send(new ChildProcessMsg_Shutdown()); 133 Send(new ChildProcessMsg_Shutdown());
134 is_shutting_down_ = true;
135 }
136
137 bool ChildProcessHostImpl::IsShuttingDown() {
138 return is_shutting_down_;
133 } 139 }
134 140
135 std::string ChildProcessHostImpl::CreateChannelMojo( 141 std::string ChildProcessHostImpl::CreateChannelMojo(
136 const std::string& child_token) { 142 const std::string& child_token) {
137 DCHECK(channel_id_.empty()); 143 DCHECK(channel_id_.empty());
138 channel_id_ = mojo::edk::GenerateRandomToken(); 144 channel_id_ = mojo::edk::GenerateRandomToken();
139 mojo::ScopedMessagePipeHandle host_handle = 145 mojo::ScopedMessagePipeHandle host_handle =
140 mojo::edk::CreateParentMessagePipe(channel_id_, child_token); 146 mojo::edk::CreateParentMessagePipe(channel_id_, child_token);
141 channel_ = IPC::ChannelMojo::Create(std::move(host_handle), 147 channel_ = IPC::ChannelMojo::Create(std::move(host_handle),
142 IPC::Channel::MODE_SERVER, this); 148 IPC::Channel::MODE_SERVER, this);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 delegate_->OnBadMessageReceived(message); 329 delegate_->OnBadMessageReceived(message);
324 } 330 }
325 331
326 void ChildProcessHostImpl::OnAllocateSharedMemory( 332 void ChildProcessHostImpl::OnAllocateSharedMemory(
327 uint32_t buffer_size, 333 uint32_t buffer_size,
328 base::SharedMemoryHandle* handle) { 334 base::SharedMemoryHandle* handle) {
329 AllocateSharedMemory(buffer_size, peer_process_.Handle(), handle); 335 AllocateSharedMemory(buffer_size, peer_process_.Handle(), handle);
330 } 336 }
331 337
332 void ChildProcessHostImpl::OnShutdownRequest() { 338 void ChildProcessHostImpl::OnShutdownRequest() {
333 if (delegate_->CanShutdown()) 339 if (delegate_->CanShutdown()) {
334 Send(new ChildProcessMsg_Shutdown()); 340 Send(new ChildProcessMsg_Shutdown());
341 is_shutting_down_ = true;
342 }
335 } 343 }
336 344
337 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( 345 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer(
338 gfx::GpuMemoryBufferId id, 346 gfx::GpuMemoryBufferId id,
339 uint32_t width, 347 uint32_t width,
340 uint32_t height, 348 uint32_t height,
341 gfx::BufferFormat format, 349 gfx::BufferFormat format,
342 gfx::BufferUsage usage, 350 gfx::BufferUsage usage,
343 gfx::GpuMemoryBufferHandle* handle) { 351 gfx::GpuMemoryBufferHandle* handle) {
344 // TODO(reveman): Add support for other types of GpuMemoryBuffers. 352 // TODO(reveman): Add support for other types of GpuMemoryBuffers.
345 353
346 // AllocateForChildProcess() will check if |width| and |height| are valid 354 // AllocateForChildProcess() will check if |width| and |height| are valid
347 // and handle failure in a controlled way when not. We just need to make 355 // and handle failure in a controlled way when not. We just need to make
348 // sure |usage| is supported here. 356 // sure |usage| is supported here.
349 if (gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) { 357 if (gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) {
350 *handle = gpu::GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( 358 *handle = gpu::GpuMemoryBufferImplSharedMemory::AllocateForChildProcess(
351 id, gfx::Size(width, height), format, peer_process_.Handle()); 359 id, gfx::Size(width, height), format, peer_process_.Handle());
352 } 360 }
353 } 361 }
354 362
355 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( 363 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer(
356 gfx::GpuMemoryBufferId id, 364 gfx::GpuMemoryBufferId id,
357 const gpu::SyncToken& sync_token) { 365 const gpu::SyncToken& sync_token) {
358 // Note: Nothing to do here as ownership of shared memory backed 366 // Note: Nothing to do here as ownership of shared memory backed
359 // GpuMemoryBuffers is passed with IPC. 367 // GpuMemoryBuffers is passed with IPC.
360 } 368 }
361 369
362 } // namespace content 370 } // namespace content
OLDNEW
« no previous file with comments | « content/common/child_process_host_impl.h ('k') | content/public/common/child_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698