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

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

Issue 14834002: Set a bit on Custom Elements on creation to simplify wrapping (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Now avoids hitting assert. Created 7 years, 7 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 | « no previous file | Source/bindings/v8/CustomElementHelpers.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 CreateSVGWrapperFunction m_svg; 81 CreateSVGWrapperFunction m_svg;
82 CreateHTMLWrapperFunction m_html; 82 CreateHTMLWrapperFunction m_html;
83 }; 83 };
84 84
85 // You can just use toV8(Node*) to get correct wrapper objects, 85 // You can just use toV8(Node*) to get correct wrapper objects,
86 // even for custom elements. Then generated 86 // even for custom elements. Then generated
87 // ElementWrapperFactories call V8CustomElement::wrap() with 87 // ElementWrapperFactories call V8CustomElement::wrap() with
88 // proper prototype instances accordingly. 88 // proper prototype instances accordingly.
89 static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creation Context, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgradeCa ndidateWrapper); 89 static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creation Context, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgradeCa ndidateWrapper);
90 90
91 static bool isCustomElement(Element*);
92
93 private: 91 private:
94 static void invokeReadyCallbackIfNeeded(Element*, v8::Handle<v8::Context>); 92 static void invokeReadyCallbackIfNeeded(Element*, v8::Handle<v8::Context>);
95 static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle< v8::Object>, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgra deCandidateWrapper); 93 static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle< v8::Object>, v8::Isolate*, const CreateWrapperFunction& createTypeExtensionUpgra deCandidateWrapper);
96 static v8::Handle<v8::Object> createUpgradeCandidateWrapper(PassRefPtr<Eleme nt>, v8::Handle<v8::Object> creationContext, v8::Isolate*, const CreateWrapperFu nction& createTypeExtensionUpgradeCandidateWrapper); 94 static v8::Handle<v8::Object> createUpgradeCandidateWrapper(PassRefPtr<Eleme nt>, v8::Handle<v8::Object> creationContext, v8::Isolate*, const CreateWrapperFu nction& createTypeExtensionUpgradeCandidateWrapper);
97 }; 95 };
98 96
99 inline v8::Handle<v8::Object> CustomElementHelpers::wrap(Element* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate, const CreateWrapperFunctio n& createWrapper) 97 inline v8::Handle<v8::Object> CustomElementHelpers::wrap(Element* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate, const CreateWrapperFunctio n& createWrapper)
100 { 98 {
101 ASSERT(impl); 99 ASSERT(impl);
102 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); 100 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
103 return CustomElementHelpers::createWrapper(impl, creationContext, isolate, c reateWrapper); 101 return CustomElementHelpers::createWrapper(impl, creationContext, isolate, c reateWrapper);
104 } 102 }
105 103
106 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state) 104 inline bool CustomElementHelpers::isValidPrototypeParameter(const ScriptValue& v alue, ScriptState* state)
107 { 105 {
108 AtomicString namespaceURI; 106 AtomicString namespaceURI;
109 return isValidPrototypeParameter(value, state, namespaceURI); 107 return isValidPrototypeParameter(value, state, namespaceURI);
110 } 108 }
111 109
112 } // namespace WebCore 110 } // namespace WebCore
113 111
114 #endif // CustomElementHelpers_h 112 #endif // CustomElementHelpers_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/CustomElementHelpers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698