Merge pull request #2014 from atom/enable-zygote

Use zygote process on Linux
This commit is contained in:
Cheng Zhao 2015-06-23 13:34:40 +08:00
commit aba517d4fd
7 changed files with 33 additions and 12 deletions

View file

@ -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"

View file

@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "atom/app/atom_main.h"
#include "atom/app/atom_main_args.h"
#include <stdlib.h>
#include <string.h>
@ -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)

View file

@ -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

View file

@ -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 <string>
#include <vector>
#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<std::string> 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<std::string> argv_;
@ -26,4 +32,4 @@ class AtomCommandLine {
} // namespace atom
#endif // ATOM_APP_ATOM_MAIN_ARGS_H_
#endif // ATOM_COMMON_ATOM_COMMAND_LINE_H_

View file

@ -7,7 +7,7 @@
#include <string>
#include <vector>
#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)

View file

@ -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',

View file

@ -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',