Skip to content

Commit

Permalink
Merge pull request #12101 from electron/upgrade-node-v9.7.0
Browse files Browse the repository at this point in the history
Update to node v9.7.0
  • Loading branch information
zcbenz committed Mar 9, 2018
2 parents cf36fde + e79b187 commit 30405a3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
9 changes: 9 additions & 0 deletions atom/browser/atom_browser_client.cc
Expand Up @@ -140,6 +140,11 @@ void AtomBrowserClient::RemoveProcessPreferences(int process_id) {
process_preferences_.erase(process_id);
}

bool AtomBrowserClient::IsProcessObserved(int process_id) {
base::AutoLock auto_lock(process_preferences_lock_);
return process_preferences_.find(process_id) != process_preferences_.end();
}

bool AtomBrowserClient::IsRendererSandboxed(int process_id) {
base::AutoLock auto_lock(process_preferences_lock_);
auto it = process_preferences_.find(process_id);
Expand All @@ -160,7 +165,11 @@ bool AtomBrowserClient::RendererDisablesPopups(int process_id) {

void AtomBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) {
// When a render process is crashed, it might be reused.
int process_id = host->GetID();
if (IsProcessObserved(process_id))
return;

host->AddFilter(new printing::PrintingMessageFilter(process_id));
host->AddFilter(new TtsMessageFilter(process_id, host->GetBrowserContext()));
host->AddFilter(
Expand Down
1 change: 1 addition & 0 deletions atom/browser/atom_browser_client.h
Expand Up @@ -126,6 +126,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
};
void AddProcessPreferences(int process_id, ProcessPreferences prefs);
void RemoveProcessPreferences(int process_id);
bool IsProcessObserved(int process_id);
bool IsRendererSandboxed(int process_id);
bool RendererUsesNativeWindowOpen(int process_id);
bool RendererDisablesPopups(int process_id);
Expand Down
19 changes: 8 additions & 11 deletions atom/common/api/atom_bindings.cc
Expand Up @@ -8,6 +8,7 @@
#include <iostream>
#include <string>

#include "atom/common/api/locker.h"
#include "atom/common/atom_version.h"
#include "atom/common/chrome_version.h"
#include "atom/common/native_mate_converters/string16_converter.h"
Expand Down Expand Up @@ -98,17 +99,13 @@ void AtomBindings::OnCallNextTick(uv_async_t* handle) {
self->pending_next_ticks_.begin();
it != self->pending_next_ticks_.end(); ++it) {
node::Environment* env = *it;
// KickNextTick, copied from node.cc:
node::Environment::AsyncCallbackScope callback_scope(env);
if (callback_scope.in_makecallback())
continue;
node::Environment::TickInfo* tick_info = env->tick_info();
if (tick_info->length() == 0)
env->isolate()->RunMicrotasks();
v8::Local<v8::Object> process = env->process_object();
if (tick_info->length() == 0)
tick_info->set_index(0);
env->tick_callback_function()->Call(process, 0, nullptr).IsEmpty();
mate::Locker locker(env->isolate());
v8::Context::Scope context_scope(env->context());
node::InternalCallbackScope scope(
env,
v8::Local<v8::Object>(),
{0, 0},
node::InternalCallbackScope::kAllowEmptyResource);
}

self->pending_next_ticks_.clear();
Expand Down
12 changes: 7 additions & 5 deletions common.gypi
Expand Up @@ -19,7 +19,7 @@
'openssl_fips': '',
'openssl_no_asm': 1,
'use_openssl_def': 0,
'OPENSSL_PRODUCT': 'libopenssl.a',
'openssl_product': 'libopenssl.a',
'node_release_urlbase': 'https://atom.io/download/electron',
'node_byteorder': '<!(node <(DEPTH)/tools/get-endianness.js)',
'node_target_type': 'shared_library',
Expand All @@ -44,15 +44,15 @@
'uv_library': 'static_library',
'uv_parent_path': 'vendor/node/deps/uv',
'uv_use_dtrace': 'false',
'V8_BASE': '',
'v8_base': '',
'v8_postmortem_support': 'false',
'v8_enable_i18n_support': 'false',
'v8_enable_inspector': '1',
},
# Settings to compile node under Windows.
'target_defaults': {
'target_conditions': [
['_target_name in ["libuv", "http_parser", "openssl", "openssl-cli", "cares", "node", "zlib", "nghttp2"]', {
['_target_name in ["libuv", "http_parser", "openssl", "openssl-cli", "cares", "node_lib", "zlib", "nghttp2"]', {
'msvs_disabled_warnings': [
4003, # not enough actual parameters for macro 'V'
4013, # 'free' undefined; assuming extern returning int
Expand All @@ -61,6 +61,7 @@
4055, # 'type cast' : from data pointer 'void *' to function pointer
4057, # 'function' : 'volatile LONG *' differs in indirection to slightly different base types from 'unsigned long *'
4065, # switch statement contains 'default' but no 'case' labels
4129, # unrecognized character escape sequence
4189, #
4131, # uses old-style declarator
4133, # incompatible types
Expand All @@ -74,6 +75,7 @@
4232, # address of dllimport 'free' is not static, identity not guaranteed
4291, # no matching operator delete found
4295, # array is too small to include a terminating null character
4309, # 'static_cast': truncation of constant value
4311, # 'type cast': pointer truncation from 'void *const ' to 'unsigned long'
4389, # '==' : signed/unsigned mismatch
4456, # declaration of 'm' hides previous local declaration
Expand Down Expand Up @@ -136,7 +138,7 @@
}],
],
}],
['_target_name=="node"', {
['_target_name=="node_lib"', {
'include_dirs': [
'<(libchromiumcontent_src_dir)',
'<(libchromiumcontent_src_dir)/third_party/icu/source/common',
Expand Down Expand Up @@ -245,7 +247,7 @@
}], # OS=="win"
],
}],
['OS=="linux" and _toolset=="target" and _target_name in ["dump_syms", "node"]', {
['OS=="linux" and _toolset=="target" and _target_name in ["dump_syms", "node_lib"]', {
'conditions': [
['libchromiumcontent_component==0', {
'libraries': [
Expand Down
2 changes: 1 addition & 1 deletion electron.gyp
Expand Up @@ -245,7 +245,7 @@
'atom_js2c',
'vendor/pdf_viewer/pdf_viewer.gyp:pdf_viewer',
'brightray/brightray.gyp:brightray',
'vendor/node/node.gyp:node',
'vendor/node/node.gyp:node_lib',
],
'defines': [
# We need to access internal implementations of Node.
Expand Down
2 changes: 1 addition & 1 deletion vendor/node
Submodule node updated 6043 files

0 comments on commit 30405a3

Please sign in to comment.