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

Side by Side Diff: chrome/test/chromedriver/chrome_launcher.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Mojo launcher, review comments Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/test/chromedriver/chrome_launcher.h" 5 #include "chrome/test/chromedriver/chrome_launcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 #endif 352 #endif
353 353
354 #if !defined(OS_WIN) 354 #if !defined(OS_WIN)
355 if (!capabilities.log_path.empty()) 355 if (!capabilities.log_path.empty())
356 options.environ["CHROME_LOG_FILE"] = capabilities.log_path; 356 options.environ["CHROME_LOG_FILE"] = capabilities.log_path;
357 if (capabilities.detach) 357 if (capabilities.detach)
358 options.new_process_group = true; 358 options.new_process_group = true;
359 #endif 359 #endif
360 360
361 #if defined(OS_POSIX) 361 #if defined(OS_POSIX)
362 base::FileHandleMappingVector no_stderr;
363 base::ScopedFD devnull; 362 base::ScopedFD devnull;
364 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { 363 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {
365 // Redirect stderr to /dev/null, so that Chrome log spew doesn't confuse 364 // Redirect stderr to /dev/null, so that Chrome log spew doesn't confuse
366 // users. 365 // users.
367 devnull.reset(HANDLE_EINTR(open("/dev/null", O_WRONLY))); 366 devnull.reset(HANDLE_EINTR(open("/dev/null", O_WRONLY)));
368 if (!devnull.is_valid()) 367 if (!devnull.is_valid())
369 return Status(kUnknownError, "couldn't open /dev/null"); 368 return Status(kUnknownError, "couldn't open /dev/null");
370 no_stderr.push_back(std::make_pair(devnull.get(), STDERR_FILENO)); 369 options.fds_to_remap.push_back(
371 options.fds_to_remap = &no_stderr; 370 std::make_pair(devnull.get(), STDERR_FILENO));
372 } 371 }
373 #elif defined(OS_WIN) 372 #elif defined(OS_WIN)
374 if (!SwitchToUSKeyboardLayout()) 373 if (!SwitchToUSKeyboardLayout())
375 VLOG(0) << "Cannot switch to US keyboard layout - some keys may be " 374 VLOG(0) << "Cannot switch to US keyboard layout - some keys may be "
376 "interpreted incorrectly"; 375 "interpreted incorrectly";
377 #endif 376 #endif
378 377
379 #if defined(OS_WIN) 378 #if defined(OS_WIN)
380 std::string command_string = base::WideToUTF8(command.GetCommandLineString()); 379 std::string command_string = base::WideToUTF8(command.GetCommandLineString());
381 #else 380 #else
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 // Write empty "First Run" file, otherwise Chrome will wipe the default 876 // Write empty "First Run" file, otherwise Chrome will wipe the default
878 // profile that was written. 877 // profile that was written.
879 if (base::WriteFile( 878 if (base::WriteFile(
880 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { 879 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) {
881 return Status(kUnknownError, "failed to write first run file"); 880 return Status(kUnknownError, "failed to write first run file");
882 } 881 }
883 return Status(kOk); 882 return Status(kOk);
884 } 883 }
885 884
886 } // namespace internal 885 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698