Swap more to UniquePersistent

This commit is contained in:
Alex Hultman 2019-01-17 06:53:30 +01:00
parent 04c8b5aba5
commit 84bcf4c62f
3 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,6 @@
// App.post and all other methods - requires good templating?
// test so that we pass Autobahn with compression/without compression with SSL/without SSL
/* Helping QtCreator */
#include "App.h"
#include <v8.h>
#include "Utilities.h"
using namespace v8;

View File

@ -24,7 +24,7 @@
using namespace v8;
/* These two are definitely static */
std::vector<Persistent<Function, CopyablePersistentTraits<Function>>> nextTickQueue;
std::vector<UniquePersistent<Function>> nextTickQueue;
Isolate *isolate;
#include "Utilities.h"
@ -35,14 +35,14 @@ Isolate *isolate;
/* We are not compatible with Node.js nextTick for performance (and standalone) reasons */
void nextTick(const FunctionCallbackInfo<Value> &args) {
nextTickQueue.push_back(Persistent<Function, CopyablePersistentTraits<Function>>(isolate, Local<Function>::Cast(args[0])));
nextTickQueue.emplace_back(UniquePersistent<Function>(isolate, Local<Function>::Cast(args[0])));
}
void emptyNextTickQueue(Isolate *isolate) {
if (nextTickQueue.size()) {
HandleScope hs(isolate);
for (Persistent<Function, CopyablePersistentTraits<Function>> &f : nextTickQueue) {
for (UniquePersistent<Function> &f : nextTickQueue) {
Local<Function>::New(isolate, f)->Call(isolate->GetCurrentContext()->Global(), 0, nullptr);
f.Reset();
}

@ -1 +1 @@
Subproject commit 6718301ac9f0385f3146bab70c9fd7d8fa305562
Subproject commit 2a62218d2a4344255463eeb7b1cbda507f90e86f