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

Side by Side Diff: content/browser/child_process_launcher.cc

Issue 625633002: Fix incorrect FD handling for StatsTable shared memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing Created 6 years, 2 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 | « no previous file | content/browser/child_process_launcher_browsertest.cc » ('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/browser/child_process_launcher.h" 5 #include "content/browser/child_process_launcher.h"
6 6
7 #include <utility> // For std::pair. 7 #include <utility> // For std::pair.
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 std::string process_type = 203 std::string process_type =
204 cmd_line->GetSwitchValueASCII(switches::kProcessType); 204 cmd_line->GetSwitchValueASCII(switches::kProcessType);
205 scoped_ptr<FileDescriptorInfo> files_to_register( 205 scoped_ptr<FileDescriptorInfo> files_to_register(
206 FileDescriptorInfoImpl::Create()); 206 FileDescriptorInfoImpl::Create());
207 files_to_register->Share(kPrimaryIPCChannel, ipcfd); 207 files_to_register->Share(kPrimaryIPCChannel, ipcfd);
208 base::StatsTable* stats_table = base::StatsTable::current(); 208 base::StatsTable* stats_table = base::StatsTable::current();
209 if (stats_table && 209 if (stats_table &&
210 base::SharedMemory::IsHandleValid( 210 base::SharedMemory::IsHandleValid(
211 stats_table->GetSharedMemoryHandle())) { 211 stats_table->GetSharedMemoryHandle())) {
212 base::FileDescriptor fd = stats_table->GetSharedMemoryHandle(); 212 base::FileDescriptor fd = stats_table->GetSharedMemoryHandle();
213 DCHECK(fd.auto_close); 213 DCHECK(!fd.auto_close);
214 files_to_register->Transfer(kStatsTableSharedMemFd, 214 files_to_register->Share(kStatsTableSharedMemFd, fd.fd);
215 base::ScopedFD(fd.fd));
216 } 215 }
217 #endif 216 #endif
218 217
219 #if defined(OS_ANDROID) 218 #if defined(OS_ANDROID)
220 // Android WebView runs in single process, ensure that we never get here 219 // Android WebView runs in single process, ensure that we never get here
221 // when running in single process mode. 220 // when running in single process mode.
222 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); 221 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess));
223 222
224 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( 223 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess(
225 *cmd_line, child_process_id, files_to_register.get()); 224 *cmd_line, child_process_id, files_to_register.get());
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 GetHandle(), background)); 515 GetHandle(), background));
517 } 516 }
518 517
519 void ChildProcessLauncher::SetTerminateChildOnShutdown( 518 void ChildProcessLauncher::SetTerminateChildOnShutdown(
520 bool terminate_on_shutdown) { 519 bool terminate_on_shutdown) {
521 if (context_.get()) 520 if (context_.get())
522 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); 521 context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
523 } 522 }
524 523
525 } // namespace content 524 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/child_process_launcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698