OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 // Need to include this before most other files because it defines | 7 // Need to include this before most other files because it defines |
8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define |
9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the | 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the |
10 // ViewMsgLog et al. functions. | 10 // ViewMsgLog et al. functions. |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "base/command_line.h" | 33 #include "base/command_line.h" |
34 #include "base/compiler_specific.h" | 34 #include "base/compiler_specific.h" |
35 #include "base/debug/debugger.h" | 35 #include "base/debug/debugger.h" |
36 #include "base/environment.h" | 36 #include "base/environment.h" |
37 #include "base/file_path.h" | 37 #include "base/file_path.h" |
38 #include "base/file_util.h" | 38 #include "base/file_util.h" |
39 #include "base/logging.h" | 39 #include "base/logging.h" |
40 #include "base/path_service.h" | 40 #include "base/path_service.h" |
41 #include "base/string_number_conversions.h" | 41 #include "base/string_number_conversions.h" |
42 #include "base/string_util.h" | 42 #include "base/string_util.h" |
| 43 #include "base/threading/thread_restrictions.h" |
43 #include "base/time.h" | 44 #include "base/time.h" |
44 #include "base/utf_string_conversions.h" | 45 #include "base/utf_string_conversions.h" |
45 #include "chrome/common/chrome_paths.h" | 46 #include "chrome/common/chrome_paths.h" |
46 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
47 #include "chrome/common/env_vars.h" | 48 #include "chrome/common/env_vars.h" |
48 #include "ipc/ipc_logging.h" | 49 #include "ipc/ipc_logging.h" |
49 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
50 #include "base/logging_win.h" | 51 #include "base/logging_win.h" |
51 #include <initguid.h> | 52 #include <initguid.h> |
52 #endif | 53 #endif |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 207 } |
207 | 208 |
208 void RedirectChromeLogging(const CommandLine& command_line) { | 209 void RedirectChromeLogging(const CommandLine& command_line) { |
209 DCHECK(!chrome_logging_redirected_) << | 210 DCHECK(!chrome_logging_redirected_) << |
210 "Attempted to redirect logging when it was already initialized."; | 211 "Attempted to redirect logging when it was already initialized."; |
211 | 212 |
212 // Redirect logs to the session log directory, if set. Otherwise | 213 // Redirect logs to the session log directory, if set. Otherwise |
213 // defaults to the profile dir. | 214 // defaults to the profile dir. |
214 FilePath log_path = GetSessionLogFile(command_line); | 215 FilePath log_path = GetSessionLogFile(command_line); |
215 | 216 |
| 217 // Creating symlink causes us to do blocking IO on UI thread. |
| 218 // Temporarily allow it until we fix http://crbug.com/61143 |
| 219 base::ThreadRestrictions::ScopedAllowIO allow_io; |
216 // Always force a new symlink when redirecting. | 220 // Always force a new symlink when redirecting. |
217 FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); | 221 FilePath target_path = SetUpSymlinkIfNeeded(log_path, true); |
218 | 222 |
219 logging::DcheckState dcheck_state = | 223 logging::DcheckState dcheck_state = |
220 command_line.HasSwitch(switches::kEnableDCHECK) ? | 224 command_line.HasSwitch(switches::kEnableDCHECK) ? |
221 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : | 225 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : |
222 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; | 226 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; |
223 | 227 |
224 // ChromeOS always logs through the symlink, so it shouldn't be | 228 // ChromeOS always logs through the symlink, so it shouldn't be |
225 // deleted if it already exists. | 229 // deleted if it already exists. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 assertions->push_back(wide_line); | 400 assertions->push_back(wide_line); |
397 ++assertion_count; | 401 ++assertion_count; |
398 } | 402 } |
399 } | 403 } |
400 log_file.close(); | 404 log_file.close(); |
401 | 405 |
402 return assertion_count; | 406 return assertion_count; |
403 } | 407 } |
404 | 408 |
405 } // namespace logging | 409 } // namespace logging |
OLD | NEW |