Leak IsolateData since Environment is also leaked

This commit is contained in:
Kevin Sawicki 2017-01-18 16:41:36 -08:00 committed by Birunthan Mohanathas
parent 54e2c480cb
commit c374e37cc4
6 changed files with 5 additions and 24 deletions

View file

@ -129,13 +129,9 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
// Support the "--debug" switch.
node_debugger_.reset(new NodeDebugger(js_env_->isolate()));
isolate_data_.reset(
new node::IsolateData(js_env_->isolate(), uv_default_loop()));
// Create the global environment.
node::Environment* env =
node_bindings_->CreateEnvironment(isolate_data_.get(),
js_env_->context());
node_bindings_->CreateEnvironment(js_env_->context());
// Make sure node can get correct environment when debugging.
if (node_debugger_->IsRunning())

View file

@ -15,10 +15,6 @@
class BrowserProcess;
namespace node {
class IsolateData;
}
namespace atom {
class AtomBindings;
@ -86,7 +82,6 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
std::unique_ptr<NodeBindings> node_bindings_;
std::unique_ptr<AtomBindings> atom_bindings_;
std::unique_ptr<NodeDebugger> node_debugger_;
std::unique_ptr<node::IsolateData> isolate_data_;
base::Timer gc_timer_;

View file

@ -144,7 +144,7 @@ void NodeBindings::Initialize() {
}
node::Environment* NodeBindings::CreateEnvironment(
node::IsolateData* isolate_data, v8::Handle<v8::Context> context) {
v8::Handle<v8::Context> context) {
auto args = AtomCommandLine::argv();
// Feed node the path to initialization script.
@ -160,7 +160,7 @@ node::Environment* NodeBindings::CreateEnvironment(
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
node::Environment* env = node::CreateEnvironment(
isolate_data, context,
new node::IsolateData(context->GetIsolate(), uv_default_loop()), context,
args.size(), c_argv.get(), 0, nullptr);
// Node uses the deprecated SetAutorunMicrotasks(false) mode, we should switch

View file

@ -16,7 +16,6 @@ class MessageLoop;
namespace node {
class Environment;
class IsolateData;
}
namespace atom {
@ -31,8 +30,7 @@ class NodeBindings {
void Initialize();
// Create the environment and load node.js.
node::Environment* CreateEnvironment(node::IsolateData* isolate_data,
v8::Handle<v8::Context> context);
node::Environment* CreateEnvironment(v8::Handle<v8::Context> context);
// Load node.js in the environment.
void LoadEnvironment(node::Environment* env);

View file

@ -349,13 +349,10 @@ void AtomRendererClient::DidCreateScriptContext(
if (first_time) {
node_bindings_->Initialize();
node_bindings_->PrepareMessageLoop();
isolate_data_.reset(new node::IsolateData(context->GetIsolate(),
uv_default_loop()));
}
// Setup node environment for each window.
node::Environment* env =
node_bindings_->CreateEnvironment(isolate_data_.get(), context);
node::Environment* env = node_bindings_->CreateEnvironment(context);
// Add Electron extended APIs.
atom_bindings_->BindTo(env->isolate(), env->process_object());

View file

@ -10,10 +10,6 @@
#include "content/public/renderer/content_renderer_client.h"
namespace node {
class IsolateData;
}
namespace atom {
class AtomBindings;
@ -73,7 +69,6 @@ class AtomRendererClient : public content::ContentRendererClient {
std::unique_ptr<NodeBindings> node_bindings_;
std::unique_ptr<AtomBindings> atom_bindings_;
std::unique_ptr<PreferencesManager> preferences_manager_;
std::unique_ptr<node::IsolateData> isolate_data_;
bool isolated_world_;
DISALLOW_COPY_AND_ASSIGN(AtomRendererClient);