| 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 "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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return; | 168 return; |
| 169 // Don't bother creating a new console for each child process if the | 169 // Don't bother creating a new console for each child process if the |
| 170 // parent process is invalid (eg: crashed). | 170 // parent process is invalid (eg: crashed). |
| 171 if (result == ERROR_GEN_FAILURE) | 171 if (result == ERROR_GEN_FAILURE) |
| 172 return; | 172 return; |
| 173 if (create_console_if_not_found) { | 173 if (create_console_if_not_found) { |
| 174 // Make a new console if attaching to parent fails with any other error. | 174 // Make a new console if attaching to parent fails with any other error. |
| 175 // It should be ERROR_INVALID_HANDLE at this point, which means the | 175 // It should be ERROR_INVALID_HANDLE at this point, which means the |
| 176 // browser was likely not started from a console. | 176 // browser was likely not started from a console. |
| 177 AllocConsole(); | 177 AllocConsole(); |
| 178 } else { |
| 179 return; |
| 178 } | 180 } |
| 179 } | 181 } |
| 180 | 182 |
| 181 // Arbitrary byte count to use when buffering output lines. More | 183 // Arbitrary byte count to use when buffering output lines. More |
| 182 // means potential waste, less means more risk of interleaved | 184 // means potential waste, less means more risk of interleaved |
| 183 // log-lines in output. | 185 // log-lines in output. |
| 184 enum { kOutputBufferSize = 64 * 1024 }; | 186 enum { kOutputBufferSize = 64 * 1024 }; |
| 185 | 187 |
| 186 if (freopen("CONOUT$", "w", stdout)) { | 188 if (freopen("CONOUT$", "w", stdout)) { |
| 187 setvbuf(stdout, NULL, _IOLBF, kOutputBufferSize); | 189 setvbuf(stdout, NULL, _IOLBF, kOutputBufferSize); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 378 |
| 377 bool GetAppOutput(const StringPiece16& cl, std::string* output) { | 379 bool GetAppOutput(const StringPiece16& cl, std::string* output) { |
| 378 return GetAppOutputInternal(cl, false, output); | 380 return GetAppOutputInternal(cl, false, output); |
| 379 } | 381 } |
| 380 | 382 |
| 381 void RaiseProcessToHighPriority() { | 383 void RaiseProcessToHighPriority() { |
| 382 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | 384 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); |
| 383 } | 385 } |
| 384 | 386 |
| 385 } // namespace base | 387 } // namespace base |
| OLD | NEW |