Commit d0a7240a authored by Sami Kyostila's avatar Sami Kyostila Committed by Commit Bot

headless: Log to user profile directory in release builds

BUG=824964

Change-Id: I4a3fb472361b8548317c42afbe09b117e25fd178
Reviewed-on: https://chromium-review.googlesource.com/984879
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547835}
parent 9f7342bf
...@@ -209,8 +209,7 @@ void HeadlessBrowserContextImpl::Close() { ...@@ -209,8 +209,7 @@ void HeadlessBrowserContextImpl::Close() {
void HeadlessBrowserContextImpl::InitWhileIOAllowed() { void HeadlessBrowserContextImpl::InitWhileIOAllowed() {
if (!context_options_->user_data_dir().empty()) { if (!context_options_->user_data_dir().empty()) {
path_ = path_ = context_options_->user_data_dir().Append(kDefaultProfileName);
context_options_->user_data_dir().Append(FILE_PATH_LITERAL("Default"));
} else { } else {
PathService::Get(base::DIR_EXE, &path_); PathService::Get(base::DIR_EXE, &path_);
} }
......
...@@ -70,6 +70,9 @@ int RunContentMain( ...@@ -70,6 +70,9 @@ int RunContentMain(
} // namespace } // namespace
const base::FilePath::CharType kDefaultProfileName[] =
FILE_PATH_LITERAL("Default");
HeadlessBrowserImpl::HeadlessBrowserImpl( HeadlessBrowserImpl::HeadlessBrowserImpl(
base::OnceCallback<void(HeadlessBrowser*)> on_start_callback, base::OnceCallback<void(HeadlessBrowser*)> on_start_callback,
HeadlessBrowser::Options options) HeadlessBrowser::Options options)
......
...@@ -33,6 +33,8 @@ namespace headless { ...@@ -33,6 +33,8 @@ namespace headless {
class HeadlessBrowserContextImpl; class HeadlessBrowserContextImpl;
class HeadlessBrowserMainParts; class HeadlessBrowserMainParts;
extern const base::FilePath::CharType kDefaultProfileName[];
// Exported for tests. // Exported for tests.
class HEADLESS_EXPORT HeadlessBrowserImpl : public HeadlessBrowser, class HEADLESS_EXPORT HeadlessBrowserImpl : public HeadlessBrowser,
public HeadlessDevToolsTarget { public HeadlessDevToolsTarget {
......
...@@ -160,10 +160,23 @@ void HeadlessContentMainDelegate::InitLogging( ...@@ -160,10 +160,23 @@ void HeadlessContentMainDelegate::InitLogging(
base::FilePath log_path; base::FilePath log_path;
logging::LoggingSettings settings; logging::LoggingSettings settings;
if (PathService::Get(base::DIR_MODULE, &log_path)) { // In release builds we should log into the user profile directory.
#ifdef NDEBUG
if (!browser_->options()->user_data_dir.empty()) {
log_path = browser_->options()->user_data_dir;
log_path = log_path.Append(kDefaultProfileName);
base::CreateDirectory(log_path);
log_path = log_path.Append(log_filename); log_path = log_path.Append(log_filename);
} else { }
log_path = log_filename; #endif // NDEBUG
// Otherwise we log to where the executable is.
if (log_path.empty()) {
if (PathService::Get(base::DIR_MODULE, &log_path)) {
log_path = log_path.Append(log_filename);
} else {
log_path = log_filename;
}
} }
std::string filename; std::string filename;
......
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