Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d4ef922

Browse filesBrowse files
joyeecheungaddaleax
authored andcommitted
src: declare process-related C++ methods in node_process.h
Instead of in node_internals.h. Also move process property accessors that are not reused into node_process_object.cc and make them static. PR-URL: #25397 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 7cbbd68 commit d4ef922
Copy full SHA for d4ef922
Expand file treeCollapse file tree

14 files changed

+116
-97
lines changed
Open diff view settings
Collapse file

‎node.gyp‎

Copy file name to clipboardExpand all lines: node.gyp
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@
450450
'src/node_perf_common.h',
451451
'src/node_persistent.h',
452452
'src/node_platform.h',
453+
'src/node_process.h',
453454
'src/node_revert.h',
454455
'src/node_root_certs.h',
455456
'src/node_stat_watcher.h',
Collapse file

‎src/env.cc‎

Copy file name to clipboardExpand all lines: src/env.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "node_native_module.h"
88
#include "node_options-inl.h"
99
#include "node_platform.h"
10+
#include "node_process.h"
1011
#include "node_worker.h"
1112
#include "tracing/agent.h"
1213
#include "tracing/traced_value.h"
Collapse file

‎src/inspector_agent.cc‎

Copy file name to clipboardExpand all lines: src/inspector_agent.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "node/inspector/protocol/Protocol.h"
1010
#include "node_errors.h"
1111
#include "node_internals.h"
12+
#include "node_process.h"
1213
#include "node_url.h"
1314
#include "v8-inspector.h"
1415
#include "v8-platform.h"
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "node_options-inl.h"
3131
#include "node_perf.h"
3232
#include "node_platform.h"
33+
#include "node_process.h"
3334
#include "node_revert.h"
3435
#include "node_version.h"
3536
#include "tracing/traced_value.h"
@@ -586,9 +587,9 @@ void Exit(const FunctionCallbackInfo<Value>& args) {
586587
}
587588

588589
static Maybe<bool> ProcessEmitWarningGeneric(Environment* env,
589-
const char* warning,
590-
const char* type = nullptr,
591-
const char* code = nullptr) {
590+
const char* warning,
591+
const char* type = nullptr,
592+
const char* code = nullptr) {
592593
HandleScope handle_scope(env->isolate());
593594
Context::Scope context_scope(env->context());
594595

@@ -746,12 +747,10 @@ void RunBootstrapping(Environment* env) {
746747

747748
// Setting global properties for the bootstrappers to use:
748749
// - global
749-
// - process._rawDebug
750750
// Expose the global object as a property on itself
751751
// (Allows you to set stuff on `global` from anywhere in JavaScript.)
752752
global->Set(context, FIXED_ONE_BYTE_STRING(env->isolate(), "global"), global)
753753
.FromJust();
754-
env->SetMethod(process, "_rawDebug", RawDebug);
755754

756755
// Create binding loaders
757756
std::vector<Local<String>> loaders_params = {
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@
1919
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

22+
#include "node_crypto.h"
2223
#include "node.h"
2324
#include "node_buffer.h"
24-
#include "node_errors.h"
2525
#include "node_constants.h"
26-
#include "node_crypto.h"
2726
#include "node_crypto_bio.h"
28-
#include "node_crypto_groups.h"
2927
#include "node_crypto_clienthello-inl.h"
30-
#include "node_mutex.h"
28+
#include "node_crypto_groups.h"
29+
#include "node_errors.h"
3130
#include "node_internals.h"
31+
#include "node_mutex.h"
32+
#include "node_process.h"
3233
#include "tls_wrap.h" // TLSWrap
3334

3435
#include "async_wrap-inl.h"
Collapse file

‎src/node_env_var.cc‎

Copy file name to clipboardExpand all lines: src/node_env_var.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#include "node_internals.h"
21
#include "node_errors.h"
2+
#include "node_internals.h"
3+
#include "node_process.h"
34

45
#ifdef __APPLE__
56
#include <crt_externs.h>
Collapse file

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

22+
#include "node_file.h"
2223
#include "aliased_buffer.h"
2324
#include "node_buffer.h"
2425
#include "node_internals.h"
26+
#include "node_process.h"
2527
#include "node_stat_watcher.h"
26-
#include "node_file.h"
28+
2729
#include "tracing/trace_event.h"
2830

2931
#include "req_wrap-inl.h"
Collapse file

‎src/node_internals.h‎

Copy file name to clipboardExpand all lines: src/node_internals.h
-31Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ void RegisterSignalHandler(int signal,
123123
bool reset_handler = false);
124124
#endif
125125

126-
v8::Local<v8::Object> CreateEnvVarProxy(v8::Local<v8::Context> context,
127-
v8::Isolate* isolate,
128-
v8::Local<v8::Value> data);
129-
130126
std::string GetHumanReadableProcessName();
131127
void GetHumanReadableProcessName(char (*name)[1024]);
132128

@@ -180,16 +176,6 @@ namespace task_queue {
180176
void PromiseRejectCallback(v8::PromiseRejectMessage message);
181177
} // namespace task_queue
182178

183-
v8::Maybe<bool> ProcessEmitWarning(Environment* env, const char* fmt, ...);
184-
v8::Maybe<bool> ProcessEmitDeprecationWarning(Environment* env,
185-
const char* warning,
186-
const char* deprecation_code);
187-
188-
v8::Local<v8::Object> CreateProcessObject(
189-
Environment* env,
190-
const std::vector<std::string>& args,
191-
const std::vector<std::string>& exec_args);
192-
193179
enum Endianness {
194180
kLittleEndian, // _Not_ LITTLE_ENDIAN, clashes with endian.h.
195181
kBigEndian
@@ -371,23 +357,6 @@ void DisposePlatform();
371357

372358
// Functions defined in node.cc that are exposed via the bootstrapper object
373359

374-
void RawDebug(const v8::FunctionCallbackInfo<v8::Value>& args);
375-
376-
void DebugPortGetter(v8::Local<v8::Name> property,
377-
const v8::PropertyCallbackInfo<v8::Value>& info);
378-
void DebugPortSetter(v8::Local<v8::Name> property,
379-
v8::Local<v8::Value> value,
380-
const v8::PropertyCallbackInfo<void>& info);
381-
382-
void GetParentProcessId(v8::Local<v8::Name> property,
383-
const v8::PropertyCallbackInfo<v8::Value>& info);
384-
385-
void ProcessTitleGetter(v8::Local<v8::Name> property,
386-
const v8::PropertyCallbackInfo<v8::Value>& info);
387-
void ProcessTitleSetter(v8::Local<v8::Name> property,
388-
v8::Local<v8::Value> value,
389-
const v8::PropertyCallbackInfo<void>& info);
390-
391360
#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__)
392361
#define NODE_IMPLEMENTS_POSIX_CREDENTIALS 1
393362
#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__)
Collapse file

‎src/node_messaging.cc‎

Copy file name to clipboardExpand all lines: src/node_messaging.cc
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
#include "debug_utils.h"
21
#include "node_messaging.h"
3-
#include "node_internals.h"
2+
#include "async_wrap-inl.h"
3+
#include "async_wrap.h"
4+
#include "debug_utils.h"
45
#include "node_buffer.h"
56
#include "node_errors.h"
6-
#include "util.h"
7+
#include "node_internals.h"
8+
#include "node_process.h"
79
#include "util-inl.h"
8-
#include "async_wrap.h"
9-
#include "async_wrap-inl.h"
10+
#include "util.h"
1011

1112
using v8::Array;
1213
using v8::ArrayBuffer;
Collapse file

‎src/node_process.h‎

Copy file name to clipboard
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ifndef SRC_NODE_PROCESS_H_
2+
#define SRC_NODE_PROCESS_H_
3+
4+
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5+
6+
#include "v8.h"
7+
8+
namespace node {
9+
10+
v8::Local<v8::Object> CreateEnvVarProxy(v8::Local<v8::Context> context,
11+
v8::Isolate* isolate,
12+
v8::Local<v8::Value> data);
13+
14+
// Most of the time, it's best to use `console.error` to write
15+
// to the process.stderr stream. However, in some cases, such as
16+
// when debugging the stream.Writable class or the process.nextTick
17+
// function, it is useful to bypass JavaScript entirely.
18+
void RawDebug(const v8::FunctionCallbackInfo<v8::Value>& args);
19+
20+
v8::Maybe<bool> ProcessEmitWarning(Environment* env, const char* fmt, ...);
21+
v8::Maybe<bool> ProcessEmitDeprecationWarning(Environment* env,
22+
const char* warning,
23+
const char* deprecation_code);
24+
25+
v8::Local<v8::Object> CreateProcessObject(
26+
Environment* env,
27+
const std::vector<std::string>& args,
28+
const std::vector<std::string>& exec_args);
29+
30+
} // namespace node
31+
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
32+
#endif // SRC_NODE_PROCESS_H_

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.