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

Unified Diff: Source/bindings/tests/results/V8TestObject.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
« no previous file with comments | « Source/bindings/tests/results/V8TestNode.cpp ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestObject.h
diff --git a/Source/bindings/tests/results/V8TestObject.h b/Source/bindings/tests/results/V8TestObject.h
index 3318c34824640b5acb225473ac036d6263a04544..492cb125fbc91fae7c1d8c2dd06a726f6c2dd545 100644
--- a/Source/bindings/tests/results/V8TestObject.h
+++ b/Source/bindings/tests/results/V8TestObject.h
@@ -35,7 +35,7 @@ public:
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestObj* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestObj*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
@@ -46,6 +46,15 @@ public:
static void customAttrAttrGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>&);
static void customAttrAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestObj* impl)
+ {
+ return impl;
+ }
+
+ static inline TestObj* fromInternalPointer(void* object)
+ {
+ return static_cast<TestObj*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestObj*, v8::Isolate*);
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*);
private:
@@ -63,7 +72,7 @@ public:
inline v8::Handle<v8::Object> wrap(TestObj* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestObject>(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
@@ -77,7 +86,7 @@ inline v8::Handle<v8::Value> toV8(TestObj* impl, v8::Handle<v8::Object> creation
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestObject>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -88,7 +97,7 @@ inline v8::Handle<v8::Value> toV8ForMainWorld(TestObj* impl, v8::Handle<v8::Obje
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<V8TestObject>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -99,7 +108,7 @@ inline v8::Handle<v8::Value> toV8Fast(TestObj* impl, const HolderContainer& cont
{
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<V8TestObject>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -111,7 +120,7 @@ inline v8::Handle<v8::Value> toV8FastForMainWorld(TestObj* impl, const HolderCon
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<V8TestObject>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
« no previous file with comments | « Source/bindings/tests/results/V8TestNode.cpp ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698