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

Side by Side Diff: base/process/launch_win.cc

Issue 220653002: Revert of Fix --enable-logging after VS2013 switch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 "base/process/launch.h" 5 #include "base/process/launch.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <io.h> 8 #include <io.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <windows.h> 10 #include <windows.h>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // that case, we don't want to open CONOUT$, because its output 56 // that case, we don't want to open CONOUT$, because its output
57 // likely does not go anywhere. 57 // likely does not go anywhere.
58 // 58 //
59 // We don't use GetStdHandle() to check stdout/stderr here because 59 // We don't use GetStdHandle() to check stdout/stderr here because
60 // it can return dangling IDs of handles that were never inherited 60 // it can return dangling IDs of handles that were never inherited
61 // by this process. These IDs could have been reused by the time 61 // by this process. These IDs could have been reused by the time
62 // this function is called. The CRT checks the validity of 62 // this function is called. The CRT checks the validity of
63 // stdout/stderr on startup (before the handle IDs can be reused). 63 // stdout/stderr on startup (before the handle IDs can be reused).
64 // _fileno(stdout) will return -2 (_NO_CONSOLE_FILENO) if stdout was 64 // _fileno(stdout) will return -2 (_NO_CONSOLE_FILENO) if stdout was
65 // invalid. 65 // invalid.
66 if (_fileno(stdout) >= 0 || _fileno(stderr) >= 0) { 66 if (_fileno(stdout) >= 0 || _fileno(stderr) >= 0)
67 // _fileno was broken for SUBSYSTEM:WINDOWS from VS2010 to VS2012/2013. 67 return;
68 // http://crbug.com/358267. Confirm that the underlying HANDLE is valid
69 // before aborting.
70 intptr_t stdout_handle = _get_osfhandle(_fileno(stdout));
71 intptr_t stderr_handle = _get_osfhandle(_fileno(stderr));
72 if (stdout_handle >= 0 || stderr_handle >= 0)
73 return;
74 }
75 68
76 if (!AttachConsole(ATTACH_PARENT_PROCESS)) { 69 if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
77 unsigned int result = GetLastError(); 70 unsigned int result = GetLastError();
78 // Was probably already attached. 71 // Was probably already attached.
79 if (result == ERROR_ACCESS_DENIED) 72 if (result == ERROR_ACCESS_DENIED)
80 return; 73 return;
81 // Don't bother creating a new console for each child process if the 74 // Don't bother creating a new console for each child process if the
82 // parent process is invalid (eg: crashed). 75 // parent process is invalid (eg: crashed).
83 if (result == ERROR_GEN_FAILURE) 76 if (result == ERROR_GEN_FAILURE)
84 return; 77 return;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 WaitForSingleObject(proc_info.process_handle(), INFINITE); 359 WaitForSingleObject(proc_info.process_handle(), INFINITE);
367 360
368 return true; 361 return true;
369 } 362 }
370 363
371 void RaiseProcessToHighPriority() { 364 void RaiseProcessToHighPriority() {
372 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); 365 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
373 } 366 }
374 367
375 } // namespace base 368 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698