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

Side by Side Diff: Source/bindings/dart/DartCustomElementConstructorBuilder.h

Issue 24294002: Dartium changes for custom element lifecycle events. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 #ifndef CustomElementConstructorBuilder_h 31 #ifndef DartCustomElementConstructorBuilder_h
32 #define CustomElementConstructorBuilder_h 32 #define DartCustomElementConstructorBuilder_h
33 33
34 #include "bindings/v8/ScriptValue.h" 34 #include "bindings/v8/CustomElementConstructorBuilder.h"
35 #include "bindings/v8/V8CustomElementLifecycleCallbacks.h" 35
36 #include "core/dom/CustomElementLifecycleCallbacks.h" 36 #include <dart_api.h>
37 #include "core/dom/QualifiedName.h"
38 #include "wtf/Noncopyable.h"
39 #include "wtf/PassRefPtr.h"
40 #include "wtf/RefPtr.h"
41 #include "wtf/text/AtomicString.h"
42 #include <v8.h> 37 #include <v8.h>
43 38
44 namespace WebCore { 39 namespace WebCore {
45 40
46 class CustomElementDefinition; 41 class CustomElementDefinition;
42 class DartCustomElementLifecycleCallbacks;
47 class Dictionary; 43 class Dictionary;
48 class Document; 44 class Document;
49 class Element;
50 class ExceptionState; 45 class ExceptionState;
51 class QualifiedName; 46 class QualifiedName;
52 class ScriptState; 47 class ScriptState;
53 class V8PerContextData; 48
54 class WrapperTypeInfo;
55 49
56 // Handles the scripting-specific parts of the Custom Elements element 50 // Handles the scripting-specific parts of the Custom Elements element
57 // registration algorithm and constructor generation algorithm. It is 51 // registration algorithm and constructor generation algorithm. It is
58 // used in the implementation of those algorithms in 52 // used in the implementation of those algorithms in
59 // Document::registerElement. 53 // Document::registerElement.
60 class CustomElementConstructorBuilder { 54 class DartCustomElementConstructorBuilder : public CustomElementConstructorBuild er {
61 WTF_MAKE_NONCOPYABLE(CustomElementConstructorBuilder); 55 WTF_MAKE_NONCOPYABLE(DartCustomElementConstructorBuilder);
62 public: 56 public:
63 CustomElementConstructorBuilder(ScriptState*, const Dictionary* options); 57 DartCustomElementConstructorBuilder(Dart_Handle type, const AtomicString& ex tendsTagName, ScriptState*, const Dictionary* options);
58 virtual ~DartCustomElementConstructorBuilder() { }
64 59
65 // The builder accumulates state and may run script at specific 60 // The builder accumulates state and may run script at specific
66 // points. These methods must be called in order. When one fails 61 // points. These methods must be called in order. When one fails
67 // (returns false), the calls must stop. 62 // (returns false), the calls must stop.
68 63
69 bool isFeatureAllowed() const; 64 virtual bool isFeatureAllowed() const;
70 bool validateOptions(const AtomicString& type, ExceptionState&); 65 virtual bool validateOptions(const AtomicString& type, ExceptionState&);
71 bool findTagName(const AtomicString& customElementType, QualifiedName& tagNa me); 66 virtual bool findTagName(const AtomicString& customElementType, QualifiedNam e& tagName);
72 PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks(); 67 virtual PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks();
73 bool createConstructor(Document*, CustomElementDefinition*, ExceptionState&) ; 68 virtual bool createConstructor(Document*, CustomElementDefinition*, Exceptio nState&);
74 bool didRegisterDefinition(CustomElementDefinition*) const; 69 virtual bool didRegisterDefinition(CustomElementDefinition*) const;
75 70
76 // This method collects a return value for the bindings. It is 71 // This method collects a return value for the bindings. It is
77 // safe to call this method even if the builder failed; it will 72 // safe to call this method even if the builder failed; it will
78 // return an empty value. 73 // return an empty value.
79 ScriptValue bindingsReturnValue() const; 74 virtual ScriptValue bindingsReturnValue() const;
80 75
81 private: 76 private:
82 static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); 77 Dart_Handle m_customType;
siva 2013/09/20 20:57:37 How do we ensure that this handle will not go out
blois 2013/09/20 22:18:03 This class is only used as a stack variable from D
83 bool hasValidPrototypeChainFor(V8PerContextData*, WrapperTypeInfo*) const; 78 Dart_Isolate m_isolate;
84 bool prototypeIsValid(const AtomicString& type, ExceptionState&) const; 79 AtomicString m_namespaceURI;
85 v8::Handle<v8::Function> retrieveCallback(v8::Isolate*, const char* name); 80 AtomicString m_extendsTagName;
86 81 AtomicString m_localName;
87 v8::Handle<v8::Context> m_context; 82 v8::Handle<v8::Context> m_context;
88 const Dictionary* m_options; 83 RefPtr<DartCustomElementLifecycleCallbacks> m_callbacks;
89 v8::Handle<v8::Object> m_prototype;
90 WrapperTypeInfo* m_wrapperType;
91 AtomicString m_namespaceURI;
92 v8::Handle<v8::Function> m_constructor;
93 RefPtr<V8CustomElementLifecycleCallbacks> m_callbacks;
94 }; 84 };
95 85
96 } 86 }
97 87
98 #endif // CustomElementConstructorBuilder_h 88 #endif // DartCustomElementConstructorBuilder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698