blob: fe9cfde9251c4c680285bc95ad980ded52e3f71d [file] [log] [blame]
Avi Drissman468e51b62022-09-13 20:47:011// Copyright 2013 The Chromium Authors
[email protected]a22998a2013-11-10 05:00:502// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]c07006b2013-11-20 03:01:445#include "gin/public/wrapper_info.h"
Dan Elphick05acd602021-08-30 15:22:076#include "v8/include/v8-object.h"
[email protected]a22998a2013-11-10 05:00:507
8namespace gin {
9
deepak.sfaaa1b62015-04-30 07:30:4810WrapperInfo* WrapperInfo::From(v8::Local<v8::Object> object) {
[email protected]a22998a2013-11-10 05:00:5011 if (object->InternalFieldCount() != kNumberOfInternalFields)
12 return NULL;
[email protected]a17807242013-11-20 21:59:5313 WrapperInfo* info = static_cast<WrapperInfo*>(
[email protected]a22998a2013-11-10 05:00:5014 object->GetAlignedPointerFromInternalField(kWrapperInfoIndex));
[email protected]a17807242013-11-20 21:59:5315 return info->embedder == kEmbedderNativeGin ? info : NULL;
[email protected]a22998a2013-11-10 05:00:5016}
17
18} // namespace gin