OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 25 matching lines...) Expand all Loading... |
36 #include "bindings/tests/idls/TestInterfaceNamedConstructor2.h" | 36 #include "bindings/tests/idls/TestInterfaceNamedConstructor2.h" |
37 #include "bindings/v8/V8Binding.h" | 37 #include "bindings/v8/V8Binding.h" |
38 #include "bindings/v8/V8DOMWrapper.h" | 38 #include "bindings/v8/V8DOMWrapper.h" |
39 #include "bindings/v8/WrapperTypeInfo.h" | 39 #include "bindings/v8/WrapperTypeInfo.h" |
40 #include "heap/Handle.h" | 40 #include "heap/Handle.h" |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 class V8TestInterfaceNamedConstructor2Constructor { | 44 class V8TestInterfaceNamedConstructor2Constructor { |
45 public: | 45 public: |
46 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWor
ldType); | 46 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); |
47 static const WrapperTypeInfo wrapperTypeInfo; | 47 static const WrapperTypeInfo wrapperTypeInfo; |
48 }; | 48 }; |
49 | 49 |
50 class V8TestInterfaceNamedConstructor2 { | 50 class V8TestInterfaceNamedConstructor2 { |
51 public: | 51 public: |
52 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); | 52 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); |
53 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va
lue>, v8::Isolate*); | 53 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va
lue>, v8::Isolate*); |
54 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWor
ldType); | 54 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); |
55 static TestInterfaceNamedConstructor2* toNative(v8::Handle<v8::Object> objec
t) | 55 static TestInterfaceNamedConstructor2* toNative(v8::Handle<v8::Object> objec
t) |
56 { | 56 { |
57 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); | 57 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); |
58 } | 58 } |
59 static TestInterfaceNamedConstructor2* toNativeWithTypeCheck(v8::Isolate*, v
8::Handle<v8::Value>); | 59 static TestInterfaceNamedConstructor2* toNativeWithTypeCheck(v8::Isolate*, v
8::Handle<v8::Value>); |
60 static const WrapperTypeInfo wrapperTypeInfo; | 60 static const WrapperTypeInfo wrapperTypeInfo; |
61 static void derefObject(void*); | 61 static void derefObject(void*); |
62 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; | 62 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; |
63 static inline void* toInternalPointer(TestInterfaceNamedConstructor2* impl) | 63 static inline void* toInternalPointer(TestInterfaceNamedConstructor2* impl) |
64 { | 64 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceNamedConstructor2
>(callbackInfo.GetReturnValue(), impl)) | 104 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceNamedConstructor2
>(callbackInfo.GetReturnValue(), impl)) |
105 return; | 105 return; |
106 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); | 106 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
107 v8SetReturnValue(callbackInfo, wrapper); | 107 v8SetReturnValue(callbackInfo, wrapper); |
108 } | 108 } |
109 | 109 |
110 template<typename CallbackInfo> | 110 template<typename CallbackInfo> |
111 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestI
nterfaceNamedConstructor2* impl) | 111 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestI
nterfaceNamedConstructor2* impl) |
112 { | 112 { |
113 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld); | 113 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate())->isMainWorld()); |
114 if (UNLIKELY(!impl)) { | 114 if (UNLIKELY(!impl)) { |
115 v8SetReturnValueNull(callbackInfo); | 115 v8SetReturnValueNull(callbackInfo); |
116 return; | 116 return; |
117 } | 117 } |
118 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceNamed
Constructor2>(callbackInfo.GetReturnValue(), impl)) | 118 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceNamed
Constructor2>(callbackInfo.GetReturnValue(), impl)) |
119 return; | 119 return; |
120 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate()); | 120 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate()); |
121 v8SetReturnValue(callbackInfo, wrapper); | 121 v8SetReturnValue(callbackInfo, wrapper); |
122 } | 122 } |
123 | 123 |
(...skipping 28 matching lines...) Expand all Loading... |
152 } | 152 } |
153 | 153 |
154 template<class CallbackInfo, class Wrappable> | 154 template<class CallbackInfo, class Wrappable> |
155 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<Te
stInterfaceNamedConstructor2> impl, Wrappable* wrappable) | 155 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<Te
stInterfaceNamedConstructor2> impl, Wrappable* wrappable) |
156 { | 156 { |
157 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); | 157 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); |
158 } | 158 } |
159 | 159 |
160 } | 160 } |
161 #endif // V8TestInterfaceNamedConstructor2_h | 161 #endif // V8TestInterfaceNamedConstructor2_h |
OLD | NEW |