Avi Drissman | 468e51b6 | 2022-09-13 20:47:01 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | c07006b | 2013-11-20 03:01:44 | [diff] [blame] | 5 | #include "gin/public/wrapper_info.h" |
Dan Elphick | 05acd60 | 2021-08-30 15:22:07 | [diff] [blame] | 6 | #include "v8/include/v8-object.h" |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 7 | |
8 | namespace gin { | ||||
9 | |||||
deepak.s | faaa1b6 | 2015-04-30 07:30:48 | [diff] [blame] | 10 | WrapperInfo* WrapperInfo::From(v8::Local<v8::Object> object) { |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 11 | if (object->InternalFieldCount() != kNumberOfInternalFields) |
12 | return NULL; | ||||
[email protected] | a1780724 | 2013-11-20 21:59:53 | [diff] [blame] | 13 | WrapperInfo* info = static_cast<WrapperInfo*>( |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 14 | object->GetAlignedPointerFromInternalField(kWrapperInfoIndex)); |
[email protected] | a1780724 | 2013-11-20 21:59:53 | [diff] [blame] | 15 | return info->embedder == kEmbedderNativeGin ? info : NULL; |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 16 | } |
17 | |||||
18 | } // namespace gin |