Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: Source/bindings/tests/results/V8TestEventTarget.h

Issue 18778002: Inherit EventTarget interface instead of duplicating its code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 This file is part of the Blink open source project. 2 This file is part of the Blink open source project.
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19 */
20 20
21 #ifndef V8TestEventTarget_h 21 #ifndef V8TestEventTarget_h
22 #define V8TestEventTarget_h 22 #define V8TestEventTarget_h
23 23
24 #include "V8EventTarget.h"
24 #include "bindings/bindings/tests/idls/TestEventTarget.h" 25 #include "bindings/bindings/tests/idls/TestEventTarget.h"
25 #include "bindings/v8/V8Binding.h" 26 #include "bindings/v8/V8Binding.h"
26 #include "bindings/v8/V8DOMWrapper.h" 27 #include "bindings/v8/V8DOMWrapper.h"
27 #include "bindings/v8/WrapperTypeInfo.h" 28 #include "bindings/v8/WrapperTypeInfo.h"
28 29
29 namespace WebCore { 30 namespace WebCore {
30 31
31 class V8TestEventTarget { 32 class V8TestEventTarget {
32 public: 33 public:
33 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e); 34 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e);
34 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*); 35 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
35 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType); 36 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWor ldType);
36 static TestEventTarget* toNative(v8::Handle<v8::Object> object) 37 static TestEventTarget* toNative(v8::Handle<v8::Object> object)
37 { 38 {
38 return reinterpret_cast<TestEventTarget*>(object->GetAlignedPointerFromI nternalField(v8DOMWrapperObjectIndex)); 39 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8 DOMWrapperObjectIndex));
39 } 40 }
40 static void derefObject(void*); 41 static void derefObject(void*);
41 static WrapperTypeInfo info; 42 static WrapperTypeInfo info;
42 static EventTarget* toEventTarget(v8::Handle<v8::Object>); 43 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
43 static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCoun t + 0; 44 static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCoun t + 0;
44 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1 ; 45 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1 ;
46 static inline void* toInternalPointer(TestEventTarget* impl)
47 {
48 return V8EventTarget::toInternalPointer(impl);
49 }
50
51 static inline TestEventTarget* fromInternalPointer(void* object)
52 {
53 return static_cast<TestEventTarget*>(V8EventTarget::fromInternalPointer( object));
54 }
45 static void installPerContextProperties(v8::Handle<v8::Object>, TestEventTar get*, v8::Isolate*) { } 55 static void installPerContextProperties(v8::Handle<v8::Object>, TestEventTar get*, v8::Isolate*) { }
46 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8: :Isolate*) { } 56 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8: :Isolate*) { }
47 private: 57 private:
48 friend v8::Handle<v8::Object> wrap(TestEventTarget*, v8::Handle<v8::Object> creationContext, v8::Isolate*); 58 friend v8::Handle<v8::Object> wrap(TestEventTarget*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
49 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestEventTarget>, v8: :Handle<v8::Object> creationContext, v8::Isolate*); 59 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestEventTarget>, v8: :Handle<v8::Object> creationContext, v8::Isolate*);
50 }; 60 };
51 61
52 template<> 62 template<>
53 class WrapperTypeTraits<TestEventTarget > { 63 class WrapperTypeTraits<TestEventTarget > {
54 public: 64 public:
55 static WrapperTypeInfo* info() { return &V8TestEventTarget::info; } 65 static WrapperTypeInfo* info() { return &V8TestEventTarget::info; }
56 }; 66 };
57 67
58 68
59 inline v8::Handle<v8::Object> wrap(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 69 inline v8::Handle<v8::Object> wrap(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
60 { 70 {
61 ASSERT(impl); 71 ASSERT(impl);
62 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); 72 ASSERT(DOMDataStore::getWrapper<V8TestEventTarget>(impl, isolate).IsEmpty()) ;
63 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) { 73 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
64 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl); 74 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl);
65 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have 75 // Might be a XXXConstructor::info instead of an XXX::info. These will b oth have
66 // the same object de-ref functions, though, so use that as the basis of the check. 76 // the same object de-ref functions, though, so use that as the basis of the check.
67 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == V8TestEventTarget::info.derefObjectFunction); 77 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == V8TestEventTarget::info.derefObjectFunction);
68 } 78 }
69 return V8TestEventTarget::createWrapper(impl, creationContext, isolate); 79 return V8TestEventTarget::createWrapper(impl, creationContext, isolate);
70 } 80 }
71 81
72 inline v8::Handle<v8::Value> toV8(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 82 inline v8::Handle<v8::Value> toV8(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
73 { 83 {
74 if (UNLIKELY(!impl)) 84 if (UNLIKELY(!impl))
75 return v8NullWithCheck(isolate); 85 return v8NullWithCheck(isolate);
76 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); 86 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestEventTarget>( impl, isolate);
77 if (!wrapper.IsEmpty()) 87 if (!wrapper.IsEmpty())
78 return wrapper; 88 return wrapper;
79 return wrap(impl, creationContext, isolate); 89 return wrap(impl, creationContext, isolate);
80 } 90 }
81 91
82 inline v8::Handle<v8::Value> toV8ForMainWorld(TestEventTarget* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate) 92 inline v8::Handle<v8::Value> toV8ForMainWorld(TestEventTarget* impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
83 { 93 {
84 ASSERT(worldType(isolate) == MainWorld); 94 ASSERT(worldType(isolate) == MainWorld);
85 if (UNLIKELY(!impl)) 95 if (UNLIKELY(!impl))
86 return v8NullWithCheck(isolate); 96 return v8NullWithCheck(isolate);
87 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl); 97 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestE ventTarget>(impl);
88 if (!wrapper.IsEmpty()) 98 if (!wrapper.IsEmpty())
89 return wrapper; 99 return wrapper;
90 return wrap(impl, creationContext, isolate); 100 return wrap(impl, creationContext, isolate);
91 } 101 }
92 102
93 template<class HolderContainer, class Wrappable> 103 template<class HolderContainer, class Wrappable>
94 inline v8::Handle<v8::Value> toV8Fast(TestEventTarget* impl, const HolderContain er& container, Wrappable* wrappable) 104 inline v8::Handle<v8::Value> toV8Fast(TestEventTarget* impl, const HolderContain er& container, Wrappable* wrappable)
95 { 105 {
96 if (UNLIKELY(!impl)) 106 if (UNLIKELY(!impl))
97 return v8::Null(container.GetIsolate()); 107 return v8::Null(container.GetIsolate());
98 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable); 108 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestEventTar get>(impl, container, wrappable);
99 if (!wrapper.IsEmpty()) 109 if (!wrapper.IsEmpty())
100 return wrapper; 110 return wrapper;
101 return wrap(impl, container.Holder(), container.GetIsolate()); 111 return wrap(impl, container.Holder(), container.GetIsolate());
102 } 112 }
103 113
104 template<class HolderContainer, class Wrappable> 114 template<class HolderContainer, class Wrappable>
105 inline v8::Handle<v8::Value> toV8FastForMainWorld(TestEventTarget* impl, const H olderContainer& container, Wrappable* wrappable) 115 inline v8::Handle<v8::Value> toV8FastForMainWorld(TestEventTarget* impl, const H olderContainer& container, Wrappable* wrappable)
106 { 116 {
107 ASSERT(worldType(container.GetIsolate()) == MainWorld); 117 ASSERT(worldType(container.GetIsolate()) == MainWorld);
108 if (UNLIKELY(!impl)) 118 if (UNLIKELY(!impl))
109 return v8::Null(container.GetIsolate()); 119 return v8::Null(container.GetIsolate());
110 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl); 120 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8Test EventTarget>(impl);
111 if (!wrapper.IsEmpty()) 121 if (!wrapper.IsEmpty())
112 return wrapper; 122 return wrapper;
113 return wrap(impl, container.Holder(), container.GetIsolate()); 123 return wrap(impl, container.Holder(), container.GetIsolate());
114 } 124 }
115 125
116 template<class HolderContainer, class Wrappable> 126 template<class HolderContainer, class Wrappable>
117 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestEventTarget > impl, const HolderContainer& container, Wrappable* wrappable) 127 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestEventTarget > impl, const HolderContainer& container, Wrappable* wrappable)
118 { 128 {
119 return toV8FastForMainWorld(impl.get(), container, wrappable); 129 return toV8FastForMainWorld(impl.get(), container, wrappable);
120 } 130 }
121 131
122 132
123 template<class HolderContainer, class Wrappable> 133 template<class HolderContainer, class Wrappable>
124 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestEventTarget > impl, const HolderContainer& container, Wrappable* wrappable) 134 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestEventTarget > impl, const HolderContainer& container, Wrappable* wrappable)
125 { 135 {
126 return toV8Fast(impl.get(), container, wrappable); 136 return toV8Fast(impl.get(), container, wrappable);
127 } 137 }
128 138
129 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestEventTarget > impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate) 139 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestEventTarget > impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate)
130 { 140 {
131 return toV8(impl.get(), creationContext, isolate); 141 return toV8(impl.get(), creationContext, isolate);
132 } 142 }
133 143
134 } 144 }
135 145
136 #endif // V8TestEventTarget_h 146 #endif // V8TestEventTarget_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestEventConstructor.cpp ('k') | Source/bindings/tests/results/V8TestEventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698