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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/tests/results/V8TestEventTarget.h
diff --git a/Source/bindings/tests/results/V8TestEventTarget.h b/Source/bindings/tests/results/V8TestEventTarget.h
index 67f6894fe5a91b176bc97c1c65474e0377a40961..b3bbbae065605d834aa3dc3e4c6b5c99bdb330de 100644
--- a/Source/bindings/tests/results/V8TestEventTarget.h
+++ b/Source/bindings/tests/results/V8TestEventTarget.h
@@ -21,6 +21,7 @@
#ifndef V8TestEventTarget_h
#define V8TestEventTarget_h
+#include "V8EventTarget.h"
#include "bindings/bindings/tests/idls/TestEventTarget.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
@@ -35,13 +36,22 @@ public:
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestEventTarget* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestEventTarget*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static EventTarget* toEventTarget(v8::Handle<v8::Object>);
static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
+ static inline void* toInternalPointer(TestEventTarget* impl)
+ {
+ return V8EventTarget::toInternalPointer(impl);
+ }
+
+ static inline TestEventTarget* fromInternalPointer(void* object)
+ {
+ return static_cast<TestEventTarget*>(V8EventTarget::fromInternalPointer(object));
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestEventTarget*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -59,7 +69,7 @@ public:
inline v8::Handle<v8::Object> wrap(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestEventTarget>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -73,7 +83,7 @@ inline v8::Handle<v8::Value> toV8(TestEventTarget* impl, v8::Handle<v8::Object>
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestEventTarget>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -84,7 +94,7 @@ inline v8::Handle<v8::Value> toV8ForMainWorld(TestEventTarget* impl, v8::Handle<
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEventTarget>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -95,7 +105,7 @@ inline v8::Handle<v8::Value> toV8Fast(TestEventTarget* impl, const HolderContain
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestEventTarget>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -107,7 +117,7 @@ inline v8::Handle<v8::Value> toV8FastForMainWorld(TestEventTarget* impl, const H
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEventTarget>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
« 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