Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-09-05 19:33:28 +0400
committerTrevor Norris <trev.norris@gmail.com>2014-09-05 20:54:10 +0400
commit06526a2a93794a973b01514ce43fcd40b911e143 (patch)
tree17bca517b9223b079e8fa014bb06fbcfaee03175
parent299cf84490a2f28ffdc4c82e4fb7078ac591b6d3 (diff)
src: remove Environment::GetCurrentChecked()
There is only one call site that uses it and that can do the checks itself. Removes ~15 lines of code. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
-rw-r--r--src/env-inl.h17
-rw-r--r--src/env.h2
-rw-r--r--src/node.cc9
3 files changed, 6 insertions, 22 deletions
diff --git a/src/env-inl.h b/src/env-inl.h
index 90fc77c6243..4bc5eb09866 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -207,23 +207,6 @@ inline Environment* Environment::GetCurrent(v8::Local<v8::Context> context) {
context->GetAlignedPointerFromEmbedderData(kContextEmbedderDataIndex));
}
-inline Environment* Environment::GetCurrentChecked(v8::Isolate* isolate) {
- if (isolate == NULL) {
- return NULL;
- } else {
- return GetCurrentChecked(isolate->GetCurrentContext());
- }
-}
-
-inline Environment* Environment::GetCurrentChecked(
- v8::Local<v8::Context> context) {
- if (context.IsEmpty()) {
- return NULL;
- } else {
- return GetCurrent(context);
- }
-}
-
inline Environment::Environment(v8::Local<v8::Context> context)
: isolate_(context->GetIsolate()),
isolate_data_(IsolateData::GetOrCreate(context->GetIsolate())),
diff --git a/src/env.h b/src/env.h
index 4a26dd11213..7fe132ce69b 100644
--- a/src/env.h
+++ b/src/env.h
@@ -359,8 +359,6 @@ class Environment {
static inline Environment* GetCurrent(v8::Isolate* isolate);
static inline Environment* GetCurrent(v8::Local<v8::Context> context);
- static inline Environment* GetCurrentChecked(v8::Isolate* isolate);
- static inline Environment* GetCurrentChecked(v8::Local<v8::Context> context);
// See CreateEnvironment() in src/node.cc.
static inline Environment* New(v8::Local<v8::Context> context);
diff --git a/src/node.cc b/src/node.cc
index d2f9f8b8d2f..76d6503366d 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -3102,9 +3102,12 @@ static void EnableDebug(Isolate* isolate, bool wait_connect) {
fprintf(stderr, "Debugger listening on port %d\n", debug_port);
fflush(stderr);
- Environment* env = Environment::GetCurrentChecked(isolate);
- if (env == NULL)
+ if (isolate == NULL)
return; // Still starting up.
+ Local<Context> context = isolate->GetCurrentContext();
+ if (context.IsEmpty())
+ return; // Still starting up.
+ Environment* env = Environment::GetCurrent(context);
// Assign environment to the debugger's context
env->AssignToContext(v8::Debug::GetDebugContext());
@@ -3624,7 +3627,7 @@ int Start(int argc, char** argv) {
env->AssignToContext(v8::Debug::GetDebugContext());
}
// This Context::Scope is here so EnableDebug() can look up the current
- // environment with Environment::GetCurrentChecked().
+ // environment with Environment::GetCurrent().
// TODO(bnoordhuis) Reorder the debugger initialization logic so it can
// be removed.
{