electron/shell/common/node_includes.h
Fedor Indutny 06a00b74e8
fix: initialize asar support in worker threads (#33216)
* fix: initialize asar support in worker threads

Use `ObjectWrap` instead of gin's Wrap in `electron_api_asar.cc` because
gin isn't fully initialized (and apparently not possible to initialize
without ruining the isolate configuration and array buffer allocator) in
worker threads. In the worker thread call `setupAsarSupport` just as we
do for the main process.

* Update lib/asar/fs-wrapper.ts

Co-authored-by: Darshan Sen <raisinten@gmail.com>

* Update patches/node/worker_thread_add_asar_support.patch

Co-authored-by: Darshan Sen <raisinten@gmail.com>

* Add a test

Co-authored-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-03-22 20:37:55 -04:00

40 lines
1.2 KiB
C

// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_COMMON_NODE_INCLUDES_H_
#define ELECTRON_SHELL_COMMON_NODE_INCLUDES_H_
// Include common headers for using node APIs.
#ifdef NODE_SHARED_MODE
#define BUILDING_NODE_EXTENSION
#endif
#undef debug_string // This is defined in macOS SDK in AssertMacros.h.
#undef require_string // This is defined in macOS SDK in AssertMacros.h.
#include "electron/push_and_undef_node_defines.h"
#include "env-inl.h"
#include "env.h"
#include "node.h"
#include "node_buffer.h"
#include "node_errors.h"
#include "node_internals.h"
#include "node_native_module_env.h"
#include "node_object_wrap.h"
#include "node_options-inl.h"
#include "node_options.h"
#include "node_platform.h"
#include "tracing/agent.h"
#include "electron/pop_node_defines.h"
// Alternative to NODE_MODULE_CONTEXT_AWARE_X.
// Allows to explicitly register builtin modules instead of using
// __attribute__((constructor)).
#define NODE_LINKED_MODULE_CONTEXT_AWARE(modname, regfunc) \
NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_LINKED)
#endif // ELECTRON_SHELL_COMMON_NODE_INCLUDES_H_