summaryrefslogtreecommitdiffstats
path: root/gin/public/wrapper_info.h
blob: 31b2a981e3cb411bd233f83d37324fa479719c8f (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
31
32
// 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.

#ifndef GIN_PUBLIC_WRAPPER_INFO_H_
#define GIN_PUBLIC_WRAPPER_INFO_H_

#include "gin/gin_export.h"
#include "gin/public/gin_embedders.h"
#include "v8/include/v8.h"

namespace gin {

// Gin embedder that use their own WrapperInfo-like structs must ensure that
// the first field is of type GinEmbedderId and has the correct id set. They
// also should use kWrapperInfoIndex to start their WrapperInfo-like struct
// and ensure that all objects have kNumberOfInternalFields internal fields.

enum InternalFields {
  kWrapperInfoIndex,
  kEncodedValueIndex,
  kNumberOfInternalFields,
};

struct GIN_EXPORT WrapperInfo {
  static WrapperInfo* From(v8::Handle<v8::Object> object);
  const GinEmbedder embedder;
};

}  // namespace gin

#endif  // GIN_PUBLIC_WRAPPER_INFO_H_