11cb0ef41Sopenharmony_ci#include "node_external_reference.h"
21cb0ef41Sopenharmony_ci#include <cinttypes>
31cb0ef41Sopenharmony_ci#include <vector>
41cb0ef41Sopenharmony_ci#include "base_object-inl.h"
51cb0ef41Sopenharmony_ci#include "util.h"
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cinamespace node {
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst std::vector<intptr_t>& ExternalReferenceRegistry::external_references() {
101cb0ef41Sopenharmony_ci  if (!is_finalized_) {
111cb0ef41Sopenharmony_ci    external_references_.push_back(reinterpret_cast<intptr_t>(nullptr));
121cb0ef41Sopenharmony_ci    is_finalized_ = true;
131cb0ef41Sopenharmony_ci  }
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci  return external_references_;
161cb0ef41Sopenharmony_ci}
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciExternalReferenceRegistry::ExternalReferenceRegistry() {
191cb0ef41Sopenharmony_ci  this->Register(BaseObject::LazilyInitializedJSTemplateConstructor);
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci#define V(modname) _register_external_reference_##modname(this);
221cb0ef41Sopenharmony_ci  EXTERNAL_REFERENCE_BINDING_LIST(V)
231cb0ef41Sopenharmony_ci#undef V
241cb0ef41Sopenharmony_ci  // TODO(joyeecheung): collect more external references here.
251cb0ef41Sopenharmony_ci}
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci}  // namespace node
28