summaryrefslogtreecommitdiffstats
path: root/gin/function_template.cc
blob: 07882e8796e8ac3c9aab37d91677aa44300fd3f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "gin/function_template.h"

#include "gin/per_isolate_data.h"

namespace gin {

WrapperInfo internal::CallbackHolderBase::kWrapperInfo = { kEmbedderNativeGin };

WrapperInfo* internal::CallbackHolderBase::GetWrapperInfo() {
  return &kWrapperInfo;
}

void InitFunctionTemplates(PerIsolateData* isolate_data) {
  if (!isolate_data->GetObjectTemplate(
          &internal::CallbackHolderBase::kWrapperInfo).IsEmpty()) {
    return;
  }

  v8::Handle<v8::ObjectTemplate> templ(
      v8::ObjectTemplate::New(isolate_data->isolate()));
  templ->SetInternalFieldCount(kNumberOfInternalFields);
  isolate_data->SetObjectTemplate(&internal::CallbackHolderBase::kWrapperInfo,
                                  templ);
}

}  // namespace gin