Commit 76b1e893 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: make specifying --vmodule work with ChromeOS

Chrome for ChromeOS builds calls to initialize logging twice. If --vmodule
is specified this triggers a CHECK in BaseInitLoggingImpl(). Make it so we
don't redirect logging if not on a device.

BUG=none
TEST=none

Change-Id: Iee4170db4b19cbf4a12add02e2497caabdfb3d59
Reviewed-on: https://chromium-review.googlesource.com/1168106Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581751}
parent 0e568630
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/sys_info.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
...@@ -46,6 +47,11 @@ void SymlinkSetUp(const base::CommandLine& command_line, ...@@ -46,6 +47,11 @@ void SymlinkSetUp(const base::CommandLine& command_line,
void RedirectChromeLogging(const base::CommandLine& command_line) { void RedirectChromeLogging(const base::CommandLine& command_line) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Only redirect when on an actual device. To do otherwise conflicts with
// --vmodule that developers may want to use.
if (!base::SysInfo::IsRunningOnChromeOS())
return;
if (chrome_logging_redirected_) { if (chrome_logging_redirected_) {
// TODO: Support multiple active users. http://crbug.com/230345 // TODO: Support multiple active users. http://crbug.com/230345
LOG(WARNING) << "NOT redirecting logging for multi-profiles case."; LOG(WARNING) << "NOT redirecting logging for multi-profiles case.";
......
...@@ -1070,8 +1070,7 @@ void UserSessionManager::CreateUserSession(const UserContext& user_context, ...@@ -1070,8 +1070,7 @@ void UserSessionManager::CreateUserSession(const UserContext& user_context,
void UserSessionManager::PreStartSession() { void UserSessionManager::PreStartSession() {
// Switch log file as soon as possible. // Switch log file as soon as possible.
if (base::SysInfo::IsRunningOnChromeOS()) logging::RedirectChromeLogging(*base::CommandLine::ForCurrentProcess());
logging::RedirectChromeLogging(*base::CommandLine::ForCurrentProcess());
} }
void UserSessionManager::StoreUserContextDataBeforeProfileIsCreated() { void UserSessionManager::StoreUserContextDataBeforeProfileIsCreated() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment