[core] refactor program object creation

This commit is contained in:
Konstantin Käfer
2019-04-02 14:11:37 +02:00
parent 33ee7e23de
commit 7f9274035b
67 changed files with 216 additions and 178 deletions

View File

@@ -6,12 +6,23 @@
#pragma GCC diagnostic pop
#include <mbgl/util/run_loop.hpp>
#include <mbgl/gfx/backend.hpp>
#include "node_map.hpp"
#include "node_logging.hpp"
#include "node_request.hpp"
#include "node_expression.hpp"
void SetBackendType(const Nan::FunctionCallbackInfo<v8::Value>& info) {
if (info.Length() < 1 || info[0]->IsUndefined()) {
return Nan::ThrowTypeError("Requires a render backend name");
}
const std::string backendName { *Nan::Utf8String(info[0]) };
(void)backendName;
}
void RegisterModule(v8::Local<v8::Object> target, v8::Local<v8::Object> module) {
// This has the effect of:
// a) Ensuring that the static local variable is initialized before any thread contention.
@@ -19,6 +30,8 @@ void RegisterModule(v8::Local<v8::Object> target, v8::Local<v8::Object> module)
static mbgl::util::RunLoop nodeRunLoop;
nodeRunLoop.stop();
Nan::SetMethod(target, "setBackendType", SetBackendType);
node_mbgl::NodeMap::Init(target);
node_mbgl::NodeRequest::Init();
node_mbgl::NodeExpression::Init(target);