Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Unified Diff: headless/lib/headless_content_main_delegate.cc

Issue 2762593002: Add --headless flag to Windows (Closed)
Patch Set: added TODO Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/headless_content_main_delegate.h ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/headless_content_main_delegate.cc
diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc
index 9428908a6657555fd751c6f28ff32fdd3554a188..59b6defce067d2e4f0cbd56dc893b075cce6817c 100644
--- a/headless/lib/headless_content_main_delegate.cc
+++ b/headless/lib/headless_content_main_delegate.cc
@@ -22,7 +22,6 @@
#include "headless/lib/browser/headless_content_browser_client.h"
#include "headless/lib/headless_crash_reporter_client.h"
#include "headless/lib/headless_macros.h"
-#include "headless/lib/renderer/headless_content_renderer_client.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/switches.h"
@@ -37,6 +36,10 @@
#include "components/crash/content/app/crashpad.h"
#endif
+#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
+#include "headless/lib/renderer/headless_content_renderer_client.h"
+#endif
+
namespace headless {
namespace {
// Keep in sync with content/common/content_constants_internal.h.
@@ -95,10 +98,16 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) {
void HeadlessContentMainDelegate::InitLogging(
const base::CommandLine& command_line) {
+ const std::string process_type =
+ command_line.GetSwitchValueASCII(switches::kProcessType);
#if !defined(OS_WIN)
if (!command_line.HasSwitch(switches::kEnableLogging))
return;
-#endif
+#else
+ // Child processes in Windows are not able to initialize logging.
+ if (!process_type.empty())
+ return;
+#endif // !defined(OS_WIN)
logging::LoggingDestination log_mode;
base::FilePath log_filename(FILE_PATH_LITERAL("chrome_debug.log"));
@@ -143,9 +152,6 @@ void HeadlessContentMainDelegate::InitLogging(
log_path = base::FilePath::FromUTF8Unsafe(filename);
}
- const std::string process_type =
- command_line.GetSwitchValueASCII(switches::kProcessType);
-
settings.logging_dest = log_mode;
settings.log_file = log_path.value().c_str();
settings.lock_log = logging::DONT_LOCK_LOG_FILE;
@@ -194,6 +200,10 @@ void HeadlessContentMainDelegate::PreSandboxStartup() {
int HeadlessContentMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
+// TODO(dvallet): Consider making a Windows specific class to make specific
+// child builds clearer.
+#if !defined(CHROME_MULTIPLE_DLL_CHILD)
+
if (!process_type.empty())
return -1;
@@ -215,6 +225,9 @@ int HeadlessContentMainDelegate::RunProcess(
// Return value >=0 here to disable calling content::BrowserMain.
return 0;
+#else
+ return -1;
+#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
}
#if !defined(OS_MACOSX) && defined(OS_POSIX) && !defined(OS_ANDROID)
@@ -275,15 +288,23 @@ void HeadlessContentMainDelegate::InitializeResourceBundle() {
content::ContentBrowserClient*
HeadlessContentMainDelegate::CreateContentBrowserClient() {
+#if defined(CHROME_MULTIPLE_DLL_CHILD)
+ return nullptr;
+#else
browser_client_ =
base::MakeUnique<HeadlessContentBrowserClient>(browser_.get());
return browser_client_.get();
+#endif
}
content::ContentRendererClient*
HeadlessContentMainDelegate::CreateContentRendererClient() {
+#if defined(CHROME_MULTIPLE_DLL_BROWSER)
+ return nullptr;
+#else
renderer_client_ = base::MakeUnique<HeadlessContentRendererClient>();
return renderer_client_.get();
+#endif
}
} // namespace headless
« no previous file with comments | « headless/lib/headless_content_main_delegate.h ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698