OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef V8DOMWrapper_h | 31 #ifndef V8DOMWrapper_h |
32 #define V8DOMWrapper_h | 32 #define V8DOMWrapper_h |
33 | 33 |
34 #include "bindings/core/v8/BindingSecurity.h" | 34 #include "bindings/core/v8/BindingSecurity.h" |
35 #include "bindings/core/v8/DOMDataStore.h" | 35 #include "bindings/core/v8/DOMDataStore.h" |
36 #include "bindings/core/v8/ScriptWrappable.h" | 36 #include "bindings/core/v8/ScriptWrappable.h" |
37 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
38 #include "core/CoreExport.h" | |
38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
39 #include "wtf/RawPtr.h" | 40 #include "wtf/RawPtr.h" |
40 #include "wtf/text/AtomicString.h" | 41 #include "wtf/text/AtomicString.h" |
41 #include <v8.h> | 42 #include <v8.h> |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class Node; | 46 class Node; |
46 struct WrapperTypeInfo; | 47 struct WrapperTypeInfo; |
47 | 48 |
48 class V8DOMWrapper { | 49 class V8DOMWrapper { |
49 STATIC_ONLY(V8DOMWrapper); | 50 STATIC_ONLY(V8DOMWrapper); |
50 public: | 51 public: |
51 static v8::Local<v8::Object> createWrapper(v8::Isolate*, v8::Local<v8::Objec t> creationContext, const WrapperTypeInfo*, ScriptWrappable*); | 52 static v8::Local<v8::Object> createWrapper(v8::Isolate*, v8::Local<v8::Objec t> creationContext, const WrapperTypeInfo*, ScriptWrappable*); |
52 static bool isWrapper(v8::Isolate*, v8::Local<v8::Value>); | 53 static bool isWrapper(v8::Isolate*, v8::Local<v8::Value>); |
53 | 54 |
54 // Associates the given ScriptWrappable with the given |wrapper| if the | 55 // Associates the given ScriptWrappable with the given |wrapper| if the |
55 // ScriptWrappable is not yet associated with any wrapper. Returns the | 56 // ScriptWrappable is not yet associated with any wrapper. Returns the |
56 // wrapper already associated or |wrapper| if not yet associated. | 57 // wrapper already associated or |wrapper| if not yet associated. |
57 // The caller should always use the returned value rather than |wrapper|. | 58 // The caller should always use the returned value rather than |wrapper|. |
58 static v8::Local<v8::Object> associateObjectWithWrapper(v8::Isolate*, Script Wrappable*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) WARN_UNUSED_R ETURN; | 59 static v8::Local<v8::Object> associateObjectWithWrapper(v8::Isolate*, Script Wrappable*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) WARN_UNUSED_R ETURN; |
59 static v8::Local<v8::Object> associateObjectWithWrapper(v8::Isolate*, Node*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) WARN_UNUSED_RETURN; | 60 static v8::Local<v8::Object> associateObjectWithWrapper(v8::Isolate*, Node*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) WARN_UNUSED_RETURN; |
60 static void setNativeInfo(v8::Local<v8::Object>, const WrapperTypeInfo*, Scr iptWrappable*); | 61 static void setNativeInfo(v8::Local<v8::Object>, const WrapperTypeInfo*, Scr iptWrappable*); |
61 static void clearNativeInfo(v8::Local<v8::Object>, const WrapperTypeInfo*); | 62 static void clearNativeInfo(v8::Local<v8::Object>, const WrapperTypeInfo*); |
62 // hasInternalFieldsSet only checks if the value has the internal fields for | 63 // hasInternalFieldsSet only checks if the value has the internal fields for |
63 // wrapper obejct and type, and does not check if it's valid or not. The | 64 // wrapper obejct and type, and does not check if it's valid or not. The |
64 // value may not be a Blink's wrapper object. In order to make sure of it, | 65 // value may not be a Blink's wrapper object. In order to make sure of it, |
65 // Use isWrapper function instead. | 66 // Use isWrapper function instead. |
66 static bool hasInternalFieldsSet(v8::Local<v8::Value>); | 67 CORE_EXPORT static bool hasInternalFieldsSet(v8::Local<v8::Value>); |
kinuko
2015/12/22 08:39:03
Is this change for working around core / modules i
ikilpatrick
2015/12/22 23:40:23
Yup, this is to get the component builds working.
| |
67 }; | 68 }; |
68 | 69 |
69 inline void V8DOMWrapper::setNativeInfo(v8::Local<v8::Object> wrapper, const Wra pperTypeInfo* wrapperTypeInfo, ScriptWrappable* scriptWrappable) | 70 inline void V8DOMWrapper::setNativeInfo(v8::Local<v8::Object> wrapper, const Wra pperTypeInfo* wrapperTypeInfo, ScriptWrappable* scriptWrappable) |
70 { | 71 { |
71 ASSERT(wrapper->InternalFieldCount() >= 2); | 72 ASSERT(wrapper->InternalFieldCount() >= 2); |
72 ASSERT(scriptWrappable); | 73 ASSERT(scriptWrappable); |
73 ASSERT(wrapperTypeInfo); | 74 ASSERT(wrapperTypeInfo); |
74 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, scriptWra ppable); | 75 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, scriptWra ppable); |
75 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast< WrapperTypeInfo*>(wrapperTypeInfo)); | 76 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast< WrapperTypeInfo*>(wrapperTypeInfo)); |
76 } | 77 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 | 162 |
162 bool m_didEnterContext; | 163 bool m_didEnterContext; |
163 v8::Local<v8::Context> m_context; | 164 v8::Local<v8::Context> m_context; |
164 v8::TryCatch m_tryCatch; | 165 v8::TryCatch m_tryCatch; |
165 bool m_convertExceptions; | 166 bool m_convertExceptions; |
166 }; | 167 }; |
167 | 168 |
168 } // namespace blink | 169 } // namespace blink |
169 | 170 |
170 #endif // V8DOMWrapper_h | 171 #endif // V8DOMWrapper_h |
OLD | NEW |