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

Side by Side Diff: Source/core/dom/custom/CustomElementScheduler.h

Issue 220013003: Simplify CustomElementScheduler by passing the enum for callback type directly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 14 matching lines...) Expand all
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 CustomElementScheduler_h 31 #ifndef CustomElementScheduler_h
32 #define CustomElementScheduler_h 32 #define CustomElementScheduler_h
33 33
34 #include "core/dom/custom/CustomElementCallbackQueue.h" 34 #include "core/dom/custom/CustomElementCallbackQueue.h"
35 #include "core/dom/custom/CustomElementLifecycleCallbacks.h"
35 #include "wtf/HashMap.h" 36 #include "wtf/HashMap.h"
36 #include "wtf/OwnPtr.h" 37 #include "wtf/OwnPtr.h"
37 #include "wtf/PassRefPtr.h" 38 #include "wtf/PassRefPtr.h"
38 #include "wtf/text/AtomicString.h" 39 #include "wtf/text/AtomicString.h"
39 40
40 namespace WebCore { 41 namespace WebCore {
41 42
42 class CustomElementDescriptor; 43 class CustomElementDescriptor;
43 class CustomElementLifecycleCallbacks;
44 class CustomElementMicrotaskImportStep; 44 class CustomElementMicrotaskImportStep;
45 class Element; 45 class Element;
46 class HTMLImportChild; 46 class HTMLImportChild;
47 47
48 class CustomElementScheduler { 48 class CustomElementScheduler {
49 public: 49 public:
50 static void scheduleCreatedCallback(PassRefPtr<CustomElementLifecycleCallbac ks>, PassRefPtr<Element>); 50 static void scheduleCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pa ssRefPtr<Element>, CustomElementLifecycleCallbacks::CallbackType);
51 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc leCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue); 51 static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecyc leCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
52 static void scheduleAttachedCallback(PassRefPtr<CustomElementLifecycleCallba cks>, PassRefPtr<Element>);
53 static void scheduleDetachedCallback(PassRefPtr<CustomElementLifecycleCallba cks>, PassRefPtr<Element>);
54 52
55 static void resolveOrScheduleResolution(PassRefPtr<CustomElementRegistration Context>, PassRefPtr<Element>, const CustomElementDescriptor&); 53 static void resolveOrScheduleResolution(PassRefPtr<CustomElementRegistration Context>, PassRefPtr<Element>, const CustomElementDescriptor&);
56 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*); 54 static CustomElementMicrotaskImportStep* scheduleImport(HTMLImportChild*);
57 55
58 static void microtaskDispatcherDidFinish(); 56 static void microtaskDispatcherDidFinish();
59 static void callbackDispatcherDidFinish(); 57 static void callbackDispatcherDidFinish();
60 58
61 private: 59 private:
62 CustomElementScheduler() { } 60 CustomElementScheduler() { }
63 61
64 static CustomElementScheduler& instance(); 62 static CustomElementScheduler& instance();
65 63
66 CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtr<Element>); 64 CustomElementCallbackQueue& ensureCallbackQueue(PassRefPtr<Element>);
67 CustomElementCallbackQueue& schedule(PassRefPtr<Element>); 65 CustomElementCallbackQueue& schedule(PassRefPtr<Element>);
68 66
69 // FIXME: Consider moving the element's callback queue to 67 // FIXME: Consider moving the element's callback queue to
70 // ElementRareData. Then the scheduler can become completely 68 // ElementRareData. Then the scheduler can become completely
71 // static. 69 // static.
72 void clearElementCallbackQueueMap(); 70 void clearElementCallbackQueueMap();
73 71
74 // The element -> callback queue map is populated by the scheduler 72 // The element -> callback queue map is populated by the scheduler
75 // and owns the lifetimes of the CustomElementCallbackQueues. 73 // and owns the lifetimes of the CustomElementCallbackQueues.
76 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba ckQueueMap; 74 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba ckQueueMap;
77 ElementCallbackQueueMap m_elementCallbackQueueMap; 75 ElementCallbackQueueMap m_elementCallbackQueueMap;
78 }; 76 };
79 77
80 } 78 }
81 79
82 #endif // CustomElementScheduler_h 80 #endif // CustomElementScheduler_h
OLDNEW
« no previous file with comments | « Source/core/dom/custom/CustomElementLifecycleCallbacks.h ('k') | Source/core/dom/custom/CustomElementScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698