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

Side by Side Diff: sky/engine/bindings-dart/core/dart/DartCustomElementConstructorBuilder.h

Issue 875013003: Import Dart bindings as of Blink r188698. This merely copies the files over and does not attach any… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
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 SKY_ENGINE_BINDINGS_CORE_V8_CUSTOMELEMENTCONSTRUCTORBUILDER_H_ 31 #ifndef DartCustomElementConstructorBuilder_h
32 #define SKY_ENGINE_BINDINGS_CORE_V8_CUSTOMELEMENTCONSTRUCTORBUILDER_H_ 32 #define DartCustomElementConstructorBuilder_h
33 33
34 #include "sky/engine/bindings/core/v8/ScriptValue.h" 34 #include "bindings/core/v8/CustomElementConstructorBuilder.h"
35 #include "sky/engine/bindings/core/v8/V8CustomElementLifecycleCallbacks.h" 35
36 #include "sky/engine/core/dom/QualifiedName.h" 36 #include <dart_api.h>
37 #include "sky/engine/core/dom/custom/CustomElementLifecycleCallbacks.h" 37 #include <v8.h>
38 #include "sky/engine/wtf/Noncopyable.h"
39 #include "sky/engine/wtf/PassRefPtr.h"
40 #include "sky/engine/wtf/RefPtr.h"
41 #include "sky/engine/wtf/text/AtomicString.h"
42 #include "v8/include/v8.h"
43 38
44 namespace blink { 39 namespace blink {
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 V8PerContextData; 47 class ScriptState;
53 struct WrapperTypeInfo; 48
54 49
55 // Handles the scripting-specific parts of the Custom Elements element 50 // Handles the scripting-specific parts of the Custom Elements element
56 // registration algorithm and constructor generation algorithm. It is 51 // registration algorithm and constructor generation algorithm. It is
57 // used in the implementation of those algorithms in 52 // used in the implementation of those algorithms in
58 // Document::registerElement. 53 // Document::registerElement.
59 class CustomElementConstructorBuilder { 54 class DartCustomElementConstructorBuilder : public CustomElementConstructorBuild er {
60 WTF_MAKE_NONCOPYABLE(CustomElementConstructorBuilder); 55 WTF_MAKE_NONCOPYABLE(DartCustomElementConstructorBuilder);
61 public: 56 public:
62 CustomElementConstructorBuilder(ScriptState*, const Dictionary* options); 57 DartCustomElementConstructorBuilder(Dart_Handle type, const AtomicString& ex tendsTagName, DartScriptState*, const Dictionary* options);
58 virtual ~DartCustomElementConstructorBuilder() { }
63 59
64 // The builder accumulates state and may run script at specific 60 // The builder accumulates state and may run script at specific
65 // points. These methods must be called in order. When one fails 61 // points. These methods must be called in order. When one fails
66 // (returns false), the calls must stop. 62 // (returns false), the calls must stop.
67 63
68 bool validateOptions(const AtomicString& type, QualifiedName& tagName, Excep tionState&); 64 virtual bool isFeatureAllowed() const;
69 PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks(); 65 virtual bool validateOptions(const AtomicString& type, QualifiedName& tagNam e, ExceptionState&);
70 bool createConstructor(Document*, CustomElementDefinition*, ExceptionState&) ; 66 virtual bool findTagName(const AtomicString& customElementType, QualifiedNam e& tagName);
71 bool didRegisterDefinition(CustomElementDefinition*) const; 67 virtual PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks();
68 virtual bool createConstructor(Document*, CustomElementDefinition*, Exceptio nState&);
69 virtual bool didRegisterDefinition(CustomElementDefinition*) const;
72 70
73 // This method collects a return value for the bindings. It is 71 // This method collects a return value for the bindings. It is
74 // 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
75 // return an empty value. 73 // return an empty value.
76 ScriptValue bindingsReturnValue() const; 74 virtual ScriptValue bindingsReturnValue() const;
77 75
78 private: 76 private:
79 bool hasValidPrototypeChainFor(const WrapperTypeInfo*) const; 77 Dart_Handle m_customType;
80 bool prototypeIsValid(const AtomicString& type, ExceptionState&) const; 78 intptr_t m_nativeClassId;
81 v8::Handle<v8::Function> retrieveCallback(v8::Isolate*, const char* name); 79 AtomicString m_namespaceURI;
82 80 AtomicString m_extendsTagName;
83 RefPtr<ScriptState> m_scriptState; 81 AtomicString m_localName;
84 const Dictionary* m_options; 82 RefPtr<DartScriptState> m_scriptState;
85 v8::Handle<v8::Object> m_prototype; 83 RefPtr<DartCustomElementLifecycleCallbacks> m_callbacks;
86 const WrapperTypeInfo* m_wrapperType;
87 v8::Handle<v8::Function> m_constructor;
88 RefPtr<V8CustomElementLifecycleCallbacks> m_callbacks;
89 }; 84 };
90 85
91 } 86 }
92 87
93 #endif // SKY_ENGINE_BINDINGS_CORE_V8_CUSTOMELEMENTCONSTRUCTORBUILDER_H_ 88 #endif // DartCustomElementConstructorBuilder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698