diff --git a/atom/app/atom_library_main.mm b/atom/app/atom_library_main.mm index 5cf910b2369a..885500beb5d3 100644 --- a/atom/app/atom_library_main.mm +++ b/atom/app/atom_library_main.mm @@ -4,9 +4,9 @@ #include "atom/app/atom_library_main.h" -#include "atom/app/atom_main_args.h" #include "atom/app/atom_main_delegate.h" #include "atom/app/node_main.h" +#include "atom/common/atom_command_line.h" #include "base/at_exit.h" #include "base/i18n/icu_util.h" #include "base/mac/bundle_locations.h" diff --git a/atom/app/atom_main.cc b/atom/app/atom_main.cc index 02dc985e30c4..47be348522f1 100644 --- a/atom/app/atom_main.cc +++ b/atom/app/atom_main.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "atom/app/atom_main.h" -#include "atom/app/atom_main_args.h" #include #include @@ -33,6 +32,7 @@ #endif // defined(OS_MACOSX) #include "atom/app/node_main.h" +#include "atom/common/atom_command_line.h" #include "base/i18n/icu_util.h" #if defined(OS_WIN) diff --git a/atom/app/atom_main_args.cc b/atom/common/atom_command_line.cc similarity index 66% rename from atom/app/atom_main_args.cc rename to atom/common/atom_command_line.cc index b9ef7c43a34b..2ac62385aeac 100644 --- a/atom/app/atom_main_args.cc +++ b/atom/common/atom_command_line.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "atom/app/atom_main_args.h" -#include "vendor/node/deps/uv/include/uv.h" +#include "atom/common/atom_command_line.h" + +#include "base/command_line.h" +#include "node/deps/uv/include/uv.h" namespace atom { @@ -19,4 +21,11 @@ void AtomCommandLine::Init(int argc, const char* const* argv) { } } +#if defined(OS_LINUX) +// static +void AtomCommandLine::InitializeFromCommandLine() { + argv_ = base::CommandLine::ForCurrentProcess()->argv(); +} +#endif + } // namespace atom diff --git a/atom/app/atom_main_args.h b/atom/common/atom_command_line.h similarity index 61% rename from atom/app/atom_main_args.h rename to atom/common/atom_command_line.h index c3bc0a9823dc..7c8840f70751 100644 --- a/atom/app/atom_main_args.h +++ b/atom/common/atom_command_line.h @@ -2,13 +2,13 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef ATOM_APP_ATOM_MAIN_ARGS_H_ -#define ATOM_APP_ATOM_MAIN_ARGS_H_ +#ifndef ATOM_COMMON_ATOM_COMMAND_LINE_H_ +#define ATOM_COMMON_ATOM_COMMAND_LINE_H_ #include #include -#include "base/macros.h" +#include "base/basictypes.h" namespace atom { @@ -18,6 +18,12 @@ class AtomCommandLine { static void Init(int argc, const char* const* argv); static std::vector argv() { return argv_; } +#if defined(OS_LINUX) + // On Linux the command line has to be read from base::CommandLine since + // it is using zygote. + static void InitializeFromCommandLine(); +#endif + private: static std::vector argv_; @@ -26,4 +32,4 @@ class AtomCommandLine { } // namespace atom -#endif // ATOM_APP_ATOM_MAIN_ARGS_H_ +#endif // ATOM_COMMON_ATOM_COMMAND_LINE_H_ diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index eb627d06b757..2d96d346d6f6 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -7,7 +7,7 @@ #include #include -#include "atom/app/atom_main_args.h" +#include "atom/common/atom_command_line.h" #include "atom/common/native_mate_converters/file_path_converter.h" #include "base/command_line.h" #include "base/base_paths.h" @@ -128,6 +128,12 @@ void NodeBindings::Initialize() { node::g_standalone_mode = is_browser_; node::g_upstream_node_mode = false; +#if defined(OS_LINUX) + // Get real command line in renderer process forked by zygote. + if (!is_browser_) + AtomCommandLine::InitializeFromCommandLine(); +#endif + // Parse the debug args. auto args = AtomCommandLine::argv(); for (const std::string& arg : args) diff --git a/filenames.gypi b/filenames.gypi index 992b16636f77..d1e210580925 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -57,8 +57,6 @@ 'lib_sources': [ 'atom/app/atom_content_client.cc', 'atom/app/atom_content_client.h', - 'atom/app/atom_main_args.cc', - 'atom/app/atom_main_args.h', 'atom/app/atom_main_delegate.cc', 'atom/app/atom_main_delegate.h', 'atom/app/atom_main_delegate_mac.mm', @@ -231,6 +229,8 @@ 'atom/common/asar/asar_util.h', 'atom/common/asar/scoped_temporary_file.cc', 'atom/common/asar/scoped_temporary_file.h', + 'atom/common/atom_command_line.cc', + 'atom/common/atom_command_line.h', 'atom/common/common_message_generator.cc', 'atom/common/common_message_generator.h', 'atom/common/crash_reporter/crash_reporter.cc', diff --git a/script/lib/config.py b/script/lib/config.py index fd9773b5a31c..274779d44a67 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -7,7 +7,7 @@ import sys BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' -LIBCHROMIUMCONTENT_COMMIT = '5ccddd5f3968a7f63eaa888e6a8ba319ea8cd3b7' +LIBCHROMIUMCONTENT_COMMIT = '3bfdfa28d2361c2242b89603b98f2509d3ebb859' PLATFORM = { 'cygwin': 'win32',