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

Side by Side Diff: Source/bindings/v8/V8DOMWrapper.h

Issue 16708002: Simplify Custom Element constructors to be functions, not wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 6 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
« no previous file with comments | « Source/bindings/v8/V8AdaptorFunction.cpp ('k') | Source/bindings/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 static v8::Local<v8::Object> createWrapper(v8::Handle<v8::Object> creati onContext, WrapperTypeInfo*, void*, v8::Isolate*); 50 static v8::Local<v8::Object> createWrapper(v8::Handle<v8::Object> creati onContext, WrapperTypeInfo*, void*, v8::Isolate*);
51 51
52 template<typename T> 52 template<typename T>
53 static inline v8::Handle<v8::Object> associateObjectWithWrapper(PassRefP tr<T>, WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfigurat ion::Lifetime); 53 static inline v8::Handle<v8::Object> associateObjectWithWrapper(PassRefP tr<T>, WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfigurat ion::Lifetime);
54 static inline void setNativeInfo(v8::Handle<v8::Object>, WrapperTypeInfo *, void*); 54 static inline void setNativeInfo(v8::Handle<v8::Object>, WrapperTypeInfo *, void*);
55 static inline void clearNativeInfo(v8::Handle<v8::Object>, WrapperTypeIn fo*); 55 static inline void clearNativeInfo(v8::Handle<v8::Object>, WrapperTypeIn fo*);
56 56
57 static bool isDOMWrapper(v8::Handle<v8::Value>); 57 static bool isDOMWrapper(v8::Handle<v8::Value>);
58 static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*); 58 static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*);
59
60 // Used for V8WrapAsFunction, which is used only by CUSTOM_ELEMENTS
61 static v8::Handle<v8::Function> toFunction(v8::Handle<v8::Value>);
62 static v8::Handle<v8::Function> toFunction(v8::Handle<v8::Object>, const AtomicString& name, v8::Isolate*);
63 static v8::Handle<v8::Object> fromFunction(v8::Handle<v8::Object>);
64 }; 59 };
65 60
66 inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, Wrap perTypeInfo* type, void* object) 61 inline void V8DOMWrapper::setNativeInfo(v8::Handle<v8::Object> wrapper, Wrap perTypeInfo* type, void* object)
67 { 62 {
68 ASSERT(wrapper->InternalFieldCount() >= 2); 63 ASSERT(wrapper->InternalFieldCount() >= 2);
69 ASSERT(object); 64 ASSERT(object);
70 ASSERT(type); 65 ASSERT(type);
71 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec t); 66 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, objec t);
72 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, type); 67 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, type);
73 } 68 }
(...skipping 12 matching lines...) Expand all
86 setNativeInfo(wrapper, type, object.get()); 81 setNativeInfo(wrapper, type, object.get());
87 ASSERT(maybeDOMWrapper(wrapper)); 82 ASSERT(maybeDOMWrapper(wrapper));
88 WrapperConfiguration configuration = buildWrapperConfiguration(object.ge t(), lifetime); 83 WrapperConfiguration configuration = buildWrapperConfiguration(object.ge t(), lifetime);
89 DOMDataStore::setWrapper(object.leakRef(), wrapper, isolate, configurati on); 84 DOMDataStore::setWrapper(object.leakRef(), wrapper, isolate, configurati on);
90 return wrapper; 85 return wrapper;
91 } 86 }
92 87
93 } 88 }
94 89
95 #endif // V8DOMWrapper_h 90 #endif // V8DOMWrapper_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8AdaptorFunction.cpp ('k') | Source/bindings/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698