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

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

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/V8DOMWrapper.h ('k') | Source/bindings/v8/V8HiddenPropertyName.h » ('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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/V8DOMWrapper.h" 32 #include "bindings/v8/V8DOMWrapper.h"
33 33
34 #include "V8DOMWindow.h" 34 #include "V8DOMWindow.h"
35 #include "V8HTMLCollection.h" 35 #include "V8HTMLCollection.h"
36 #include "V8HTMLDocument.h" 36 #include "V8HTMLDocument.h"
37 #include "bindings/v8/V8AdaptorFunction.h"
38 #include "bindings/v8/V8Binding.h" 37 #include "bindings/v8/V8Binding.h"
39 #include "bindings/v8/V8HiddenPropertyName.h" 38 #include "bindings/v8/V8HiddenPropertyName.h"
40 #include "bindings/v8/V8ObjectConstructor.h" 39 #include "bindings/v8/V8ObjectConstructor.h"
41 #include "bindings/v8/V8PerContextData.h" 40 #include "bindings/v8/V8PerContextData.h"
42 #include "bindings/v8/V8ScriptRunner.h" 41 #include "bindings/v8/V8ScriptRunner.h"
43 42
44 namespace WebCore { 43 namespace WebCore {
45 44
46 class V8WrapperInstantiationScope { 45 class V8WrapperInstantiationScope {
47 public: 46 public:
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return false; 163 return false;
165 164
166 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(value); 165 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(value);
167 ASSERT(wrapper->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount); 166 ASSERT(wrapper->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount);
168 ASSERT(wrapper->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) ; 167 ASSERT(wrapper->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) ;
169 168
170 WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(wrapper->GetAligne dPointerFromInternalField(v8DOMWrapperTypeIndex)); 169 WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(wrapper->GetAligne dPointerFromInternalField(v8DOMWrapperTypeIndex));
171 return typeInfo == type; 170 return typeInfo == type;
172 } 171 }
173 172
174 v8::Handle<v8::Function> V8DOMWrapper::toFunction(v8::Handle<v8::Value> object)
175 {
176 return V8AdaptorFunction::get(v8::Handle<v8::Object>::Cast(object));
177 }
178
179 v8::Handle<v8::Function> V8DOMWrapper::toFunction(v8::Handle<v8::Object> object, const AtomicString& name, v8::Isolate* isolate)
180 {
181 return V8AdaptorFunction::wrap(object, name, isolate);
182 }
183
184 v8::Handle<v8::Object> V8DOMWrapper::fromFunction(v8::Handle<v8::Object> object)
185 {
186 if (!object->IsFunction())
187 return object;
188 return V8AdaptorFunction::unwrap(v8::Handle<v8::Function>::Cast(object));
189 }
190
191 } // namespace WebCore 173 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8DOMWrapper.h ('k') | Source/bindings/v8/V8HiddenPropertyName.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698