| 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 "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. |
| 11 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
| 12 | 12 |
| 13 // On Windows, the about:ipc dialog shows IPCs; on POSIX, we hook up a | 13 // On Windows, the about:ipc dialog shows IPCs; on POSIX, we hook up a |
| 14 // logger in this file. (We implement about:ipc on Mac but implement | 14 // logger in this file. (We implement about:ipc on Mac but implement |
| 15 // the loggers here anyway). We need to do this real early to be sure | 15 // the loggers here anyway). We need to do this real early to be sure |
| 16 // IPC_MESSAGE_MACROS_LOG_ENABLED doesn't get undefined. | 16 // IPC_MESSAGE_MACROS_LOG_ENABLED doesn't get undefined. |
| 17 #if defined(OS_POSIX) && defined(IPC_MESSAGE_LOG_ENABLED) | 17 #if defined(OS_POSIX) && defined(IPC_MESSAGE_LOG_ENABLED) |
| 18 #define IPC_MESSAGE_MACROS_LOG_ENABLED | 18 #define IPC_MESSAGE_MACROS_LOG_ENABLED |
| 19 #include "content/public/common/content_ipc_logging.h" |
| 20 #define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) \ |
| 21 content::RegisterIPCLogger(msg_id, logger) |
| 19 #include "chrome/common/all_messages.h" | 22 #include "chrome/common/all_messages.h" |
| 20 #endif | 23 #endif |
| 21 | 24 |
| 22 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 23 #include <windows.h> | 26 #include <windows.h> |
| 24 #endif | 27 #endif |
| 25 | 28 |
| 26 #include <fstream> | 29 #include <fstream> |
| 27 | 30 |
| 28 #include "chrome/common/logging_chrome.h" | 31 #include "chrome/common/logging_chrome.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 254 } |
| 252 } | 255 } |
| 253 | 256 |
| 254 #endif // OS_CHROMEOS | 257 #endif // OS_CHROMEOS |
| 255 | 258 |
| 256 void InitChromeLogging(const CommandLine& command_line, | 259 void InitChromeLogging(const CommandLine& command_line, |
| 257 OldFileDeletionState delete_old_log_file) { | 260 OldFileDeletionState delete_old_log_file) { |
| 258 DCHECK(!chrome_logging_initialized_) << | 261 DCHECK(!chrome_logging_initialized_) << |
| 259 "Attempted to initialize logging when it was already initialized."; | 262 "Attempted to initialize logging when it was already initialized."; |
| 260 | 263 |
| 261 #if defined(OS_POSIX) && defined(IPC_MESSAGE_LOG_ENABLED) | |
| 262 IPC::Logging::set_log_function_map(&g_log_function_mapping); | |
| 263 #endif | |
| 264 LoggingDestination logging_dest = DetermineLogMode(command_line); | 264 LoggingDestination logging_dest = DetermineLogMode(command_line); |
| 265 LogLockingState log_locking_state = LOCK_LOG_FILE; | 265 LogLockingState log_locking_state = LOCK_LOG_FILE; |
| 266 FilePath log_path; | 266 FilePath log_path; |
| 267 #if defined(OS_CHROMEOS) | 267 #if defined(OS_CHROMEOS) |
| 268 FilePath target_path; | 268 FilePath target_path; |
| 269 #endif | 269 #endif |
| 270 | 270 |
| 271 // Don't resolve the log path unless we need to. Otherwise we leave an open | 271 // Don't resolve the log path unless we need to. Otherwise we leave an open |
| 272 // ALPC handle after sandbox lockdown on Windows. | 272 // ALPC handle after sandbox lockdown on Windows. |
| 273 if (logging_dest == LOG_ONLY_TO_FILE || | 273 if (logging_dest == LOG_ONLY_TO_FILE || |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 time_deets.year, | 469 time_deets.year, |
| 470 time_deets.month, | 470 time_deets.month, |
| 471 time_deets.day_of_month, | 471 time_deets.day_of_month, |
| 472 time_deets.hour, | 472 time_deets.hour, |
| 473 time_deets.minute, | 473 time_deets.minute, |
| 474 time_deets.second); | 474 time_deets.second); |
| 475 return base_path.InsertBeforeExtensionASCII(suffix); | 475 return base_path.InsertBeforeExtensionASCII(suffix); |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace logging | 478 } // namespace logging |
| OLD | NEW |