refactor: move CompileAndCall to a helper (#20675)

This commit is contained in:
Shelley Vohr 2019-10-23 09:26:32 -07:00 committed by GitHub
parent 5abce7ec08
commit db4d01c517
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 86 additions and 76 deletions

View file

@ -16,12 +16,12 @@
#include "shell/common/gin_helper/event_emitter_caller.h"
#include "shell/common/node_bindings.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
#include "shell/common/options_switches.h"
#include "shell/renderer/atom_render_frame_observer.h"
#include "shell/renderer/web_worker_observer.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/electron_node/src/node_native_module_env.h"
namespace electron {
@ -227,9 +227,8 @@ void AtomRendererClient::SetupMainWorldOverrides(
env->process_object(),
GetContext(render_frame->GetWebFrame(), isolate)->Global()};
node::native_module::NativeModuleEnv::CompileAndCall(
context, "electron/js2c/isolated_bundle", &isolated_bundle_params,
&isolated_bundle_args, nullptr);
util::CompileAndCall(context, "electron/js2c/isolated_bundle",
&isolated_bundle_params, &isolated_bundle_args, nullptr);
}
void AtomRendererClient::SetupExtensionWorldOverrides(
@ -255,9 +254,8 @@ void AtomRendererClient::SetupExtensionWorldOverrides(
GetContext(render_frame->GetWebFrame(), isolate)->Global(),
v8::Integer::New(isolate, world_id)};
node::native_module::NativeModuleEnv::CompileAndCall(
context, "electron/js2c/content_script_bundle", &isolated_bundle_params,
&isolated_bundle_args, nullptr);
util::CompileAndCall(context, "electron/js2c/content_script_bundle",
&isolated_bundle_params, &isolated_bundle_args, nullptr);
#endif
}