[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
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" |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 6 | |
7 | namespace gin { | ||||
8 | |||||
9 | WrapperInfo* WrapperInfo::From(v8::Handle<v8::Object> object) { | ||||
10 | if (object->InternalFieldCount() != kNumberOfInternalFields) | ||||
11 | return NULL; | ||||
[email protected] | a1780724 | 2013-11-20 21:59:53 | [diff] [blame^] | 12 | WrapperInfo* info = static_cast<WrapperInfo*>( |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 13 | object->GetAlignedPointerFromInternalField(kWrapperInfoIndex)); |
[email protected] | a1780724 | 2013-11-20 21:59:53 | [diff] [blame^] | 14 | return info->embedder == kEmbedderNativeGin ? info : NULL; |
[email protected] | a22998a | 2013-11-10 05:00:50 | [diff] [blame] | 15 | } |
16 | |||||
17 | } // namespace gin |