Skip to content

Commit ee5e4ad

Browse files
sjanuaryhhellyer
authored andcommitted
Use Locals instead of Handles (#292)
1 parent bc17c3a commit ee5e4ad

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/appmetrics.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static std::string fileJoin(const std::string& path, const std::string& filename
147147
return path + fileSeparator + filename;
148148
}
149149

150-
static std::string* getModuleDir(Handle<Object> module) {
150+
static std::string* getModuleDir(Local<Object> module) {
151151
std::string moduleFilename(toStdString(module->Get(Nan::New<String>("filename").ToLocalChecked())->ToString()));
152152
return new std::string(portDirname(moduleFilename));
153153
}
@@ -157,7 +157,7 @@ static Local<Object> getProcessObject() {
157157
}
158158

159159
static std::string* findApplicationDir() {
160-
Handle<Value> mainModule = getProcessObject()->Get(Nan::New<String>("mainModule").ToLocalChecked());
160+
Local<Value> mainModule = getProcessObject()->Get(Nan::New<String>("mainModule").ToLocalChecked());
161161
if (!mainModule->IsUndefined()) {
162162
return getModuleDir(mainModule->ToObject());
163163
}
@@ -551,9 +551,9 @@ void lrtime(const Nan::FunctionCallbackInfo<v8::Value>& info) {
551551
// directly by NativeModule.require() (in Module._load())
552552
// So we need to get it from Module._cache instead (by
553553
// executing require('module')._cache)
554-
static Local<Object> getRequireCache(Handle<Object> module) {
554+
static Local<Object> getRequireCache(Local<Object> module) {
555555
Nan::EscapableHandleScope scope;
556-
Handle<Value> args[] = { Nan::New<String>("module").ToLocalChecked() };
556+
Local<Value> args[] = { Nan::New<String>("module").ToLocalChecked() };
557557
Local<Value> m = module->Get(Nan::New<String>("require").ToLocalChecked())->ToObject()->CallAsFunction(Nan::GetCurrentContext()->Global(), 1, args);
558558
Local<Object> cache = m->ToObject()->Get(Nan::New<String>("_cache").ToLocalChecked())->ToObject();
559559
return scope.Escape(cache);
@@ -594,7 +594,7 @@ static bool isAppMetricsFile(std::string expected, std::string potentialMatch) {
594594
// ^--- .../node_modules/appmetrics/index.js (parent)
595595
// ^-- .../node_modules/appmetrics/appmetrics.node (this)
596596
//
597-
static bool isGlobalAgent(Handle<Object> module) {
597+
static bool isGlobalAgent(Local<Object> module) {
598598
Nan::HandleScope scope;
599599
Local<Value> parent = module->Get(Nan::New<String>("parent").ToLocalChecked());
600600
if (parent->IsObject()) {
@@ -613,7 +613,7 @@ static bool isGlobalAgent(Handle<Object> module) {
613613
// Check if a global appmetrics agent module is already loaded.
614614
// This is actually searching the module cache for a module with filepath
615615
// ending .../appmetrics/launcher.js
616-
static bool isGlobalAgentAlreadyLoaded(Handle<Object> module) {
616+
static bool isGlobalAgentAlreadyLoaded(Local<Object> module) {
617617
//Nan::HandleScope scope;
618618
Local<Object> cache = getRequireCache(module);
619619
Local<Array> props = cache->GetOwnPropertyNames();
@@ -629,7 +629,7 @@ static bool isGlobalAgentAlreadyLoaded(Handle<Object> module) {
629629
return false;
630630
}
631631

632-
void init(Handle<Object> exports, Handle<Object> module) {
632+
void init(Local<Object> exports, Local<Object> module) {
633633
/*
634634
* Throw an error if appmetrics has already been loaded globally
635635
*/

0 commit comments

Comments
 (0)