OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FXJSE_UTIL_INLINE_H_ | 7 #ifndef XFA_SRC_FXJSE_SRC_UTIL_INLINE_H_ |
8 #define FXJSE_UTIL_INLINE_H_ | 8 #define XFA_SRC_FXJSE_SRC_UTIL_INLINE_H_ |
| 9 |
9 static V8_INLINE v8::Local<v8::Object> FXJSE_GetGlobalObjectFromContext( | 10 static V8_INLINE v8::Local<v8::Object> FXJSE_GetGlobalObjectFromContext( |
10 const v8::Local<v8::Context>& hContext) { | 11 const v8::Local<v8::Context>& hContext) { |
11 return hContext->Global()->GetPrototype().As<v8::Object>(); | 12 return hContext->Global()->GetPrototype().As<v8::Object>(); |
12 } | 13 } |
13 static V8_INLINE void FXJSE_UpdateObjectBinding(v8::Local<v8::Object>& hObject, | 14 static V8_INLINE void FXJSE_UpdateObjectBinding(v8::Local<v8::Object>& hObject, |
14 void* lpNewBinding) { | 15 void* lpNewBinding) { |
15 ASSERT(!hObject.IsEmpty()); | 16 ASSERT(!hObject.IsEmpty()); |
16 ASSERT(hObject->InternalFieldCount() > 0); | 17 ASSERT(hObject->InternalFieldCount() > 0); |
17 hObject->SetAlignedPointerInInternalField(0, lpNewBinding); | 18 hObject->SetAlignedPointerInInternalField(0, lpNewBinding); |
18 } | 19 } |
(...skipping 18 matching lines...) Expand all Loading... |
37 if (lpClass) { | 38 if (lpClass) { |
38 v8::Local<v8::FunctionTemplate> hClass = | 39 v8::Local<v8::FunctionTemplate> hClass = |
39 v8::Local<v8::FunctionTemplate>::New( | 40 v8::Local<v8::FunctionTemplate>::New( |
40 lpClass->GetContext()->GetRuntime(), lpClass->GetTemplate()); | 41 lpClass->GetContext()->GetRuntime(), lpClass->GetTemplate()); |
41 if (!hClass->HasInstance(hObject)) { | 42 if (!hClass->HasInstance(hObject)) { |
42 return NULL; | 43 return NULL; |
43 } | 44 } |
44 } | 45 } |
45 return hObject->GetAlignedPointerFromInternalField(0); | 46 return hObject->GetAlignedPointerFromInternalField(0); |
46 } | 47 } |
47 #endif | 48 |
| 49 #endif // XFA_SRC_FXJSE_SRC_UTIL_INLINE_H_ |
OLD | NEW |