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

Side by Side Diff: Source/core/dom/CustomElementCallbackDispatcher.h

Issue 18167006: Implement Custom Elements' entered and left document callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Feedback. Created 7 years, 5 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 processElementQueueAndPop(); 61 processElementQueueAndPop();
62 s_elementQueueStart = m_savedElementQueueStart; 62 s_elementQueueStart = m_savedElementQueueStart;
63 } 63 }
64 64
65 private: 65 private:
66 size_t m_savedElementQueueStart; 66 size_t m_savedElementQueueStart;
67 }; 67 };
68 68
69 void enqueueAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallba cks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValu e, const AtomicString& newValue); 69 void enqueueAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallba cks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValu e, const AtomicString& newValue);
70 void enqueueCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pas sRefPtr<Element>); 70 void enqueueCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, Pas sRefPtr<Element>);
71 void enqueueEnteredDocumentCallback(PassRefPtr<CustomElementLifecycleCallbac ks>, PassRefPtr<Element>);
72 void enqueueLeftDocumentCallback(PassRefPtr<CustomElementLifecycleCallbacks> , PassRefPtr<Element>);
71 73
72 // Returns true if more work may have to be performed at the 74 // Returns true if more work may have to be performed at the
73 // checkpoint by this or other workers (for example, this work 75 // checkpoint by this or other workers (for example, this work
74 // invoked author scripts) 76 // invoked author scripts)
75 bool dispatch(); 77 bool dispatch();
76 78
77 private: 79 private:
78 CustomElementCallbackDispatcher() 80 CustomElementCallbackDispatcher()
79 { 81 {
80 // Add a null element as a sentinel. This makes it possible to 82 // Add a null element as a sentinel. This makes it possible to
(...skipping 15 matching lines...) Expand all
96 static size_t s_elementQueueEnd; 98 static size_t s_elementQueueEnd;
97 99
98 static bool inCallbackDeliveryScope() { return s_elementQueueStart; } 100 static bool inCallbackDeliveryScope() { return s_elementQueueStart; }
99 101
100 typedef int ElementQueue; 102 typedef int ElementQueue;
101 static ElementQueue currentElementQueue() { return ElementQueue(s_elementQue ueStart); } 103 static ElementQueue currentElementQueue() { return ElementQueue(s_elementQue ueStart); }
102 104
103 static void processElementQueueAndPop(); 105 static void processElementQueueAndPop();
104 void processElementQueueAndPop(size_t start, size_t end); 106 void processElementQueueAndPop(size_t start, size_t end);
105 107
106 CustomElementCallbackQueue* createCallbackQueue(PassRefPtr<CustomElementLife cycleCallbacks>, PassRefPtr<Element>); 108 CustomElementCallbackQueue* createCallbackQueue(PassRefPtr<Element>);
107 CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<CustomElementLife cycleCallbacks>, PassRefPtr<Element>); 109 CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>);
110 CustomElementCallbackQueue* scheduleInCurrentElementQueue(PassRefPtr<Element >);
108 111
109 // The processing stack, flattened. Element queues lower in the 112 // The processing stack, flattened. Element queues lower in the
110 // stack appear toward the head of the vector. The first element 113 // stack appear toward the head of the vector. The first element
111 // is a null sentinel value. 114 // is a null sentinel value.
112 Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack; 115 Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack;
113 116
114 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba ckQueueMap; 117 typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallba ckQueueMap;
115 ElementCallbackQueueMap m_elementCallbackQueueMap; 118 ElementCallbackQueueMap m_elementCallbackQueueMap;
116 }; 119 };
117 120
118 } 121 }
119 122
120 #endif // CustomElementCallbackDispatcher_h 123 #endif // CustomElementCallbackDispatcher_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8NodeCustom.cpp ('k') | Source/core/dom/CustomElementCallbackDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698