OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "headless/lib/headless_content_main_delegate.h" | 5 #include "headless/lib/headless_content_main_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 base::FilePath log_path; | 107 base::FilePath log_path; |
108 logging::LoggingSettings settings; | 108 logging::LoggingSettings settings; |
109 | 109 |
110 if (PathService::Get(base::DIR_MODULE, &log_path)) { | 110 if (PathService::Get(base::DIR_MODULE, &log_path)) { |
111 log_path = log_path.Append(log_filename); | 111 log_path = log_path.Append(log_filename); |
112 } else { | 112 } else { |
113 log_path = log_filename; | 113 log_path = log_filename; |
114 } | 114 } |
115 | 115 |
| 116 const std::string process_type = |
| 117 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 118 |
116 settings.logging_dest = log_mode; | 119 settings.logging_dest = log_mode; |
117 settings.log_file = log_path.value().c_str(); | 120 settings.log_file = log_path.value().c_str(); |
118 settings.lock_log = logging::DONT_LOCK_LOG_FILE; | 121 settings.lock_log = logging::DONT_LOCK_LOG_FILE; |
119 settings.delete_old = logging::DELETE_OLD_LOG_FILE; | 122 settings.delete_old = process_type.empty() ? logging::DELETE_OLD_LOG_FILE |
| 123 : logging::APPEND_TO_OLD_LOG_FILE; |
120 bool success = logging::InitLogging(settings); | 124 bool success = logging::InitLogging(settings); |
121 DCHECK(success); | 125 DCHECK(success); |
122 } | 126 } |
123 | 127 |
124 void HeadlessContentMainDelegate::PreSandboxStartup() { | 128 void HeadlessContentMainDelegate::PreSandboxStartup() { |
125 InitLogging(*base::CommandLine::ForCurrentProcess()); | 129 InitLogging(*base::CommandLine::ForCurrentProcess()); |
126 InitializeResourceBundle(); | 130 InitializeResourceBundle(); |
127 } | 131 } |
128 | 132 |
129 int HeadlessContentMainDelegate::RunProcess( | 133 int HeadlessContentMainDelegate::RunProcess( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 pak_file, ui::SCALE_FACTOR_NONE); | 187 pak_file, ui::SCALE_FACTOR_NONE); |
184 } | 188 } |
185 | 189 |
186 content::ContentBrowserClient* | 190 content::ContentBrowserClient* |
187 HeadlessContentMainDelegate::CreateContentBrowserClient() { | 191 HeadlessContentMainDelegate::CreateContentBrowserClient() { |
188 browser_client_.reset(new HeadlessContentBrowserClient(browser_.get())); | 192 browser_client_.reset(new HeadlessContentBrowserClient(browser_.get())); |
189 return browser_client_.get(); | 193 return browser_client_.get(); |
190 } | 194 } |
191 | 195 |
192 } // namespace headless | 196 } // namespace headless |
OLD | NEW |