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

Side by Side Diff: Source/core/dom/CustomElementCallbackQueue.cpp

Issue 18789002: Implement Custom Elements' attributeChangedCallback. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Sync to tip. 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 , m_index(0) 47 , m_index(0)
48 { 48 {
49 } 49 }
50 50
51 void CustomElementCallbackQueue::processInElementQueue(ElementQueue caller) 51 void CustomElementCallbackQueue::processInElementQueue(ElementQueue caller)
52 { 52 {
53 for (; m_index < m_queue.size() && owner() == caller; m_index++) { 53 for (; m_index < m_queue.size() && owner() == caller; m_index++) {
54 // dispatch() may cause recursion which steals this callback 54 // dispatch() may cause recursion which steals this callback
55 // queue and reenters processInQueue. owner() == caller 55 // queue and reenters processInQueue. owner() == caller
56 // detects this recursion and cedes processing. 56 // detects this recursion and cedes processing.
57 dispatch(m_queue[m_index]); 57 m_queue[m_index]->dispatch(m_callbacks.get(), m_element.get());
58 } 58 }
59 59
60 // FIXME: While there is only one kind of callback, stealing work
61 // is not possible. Remove this when there is a second kind of
62 // callback plus tests for shifting callback queues between
63 // element queues.
64 ASSERT(owner() == caller);
65
66 if (owner() == caller && m_index == m_queue.size()) { 60 if (owner() == caller && m_index == m_queue.size()) {
67 // This processInQueue exhausted the queue; shrink it. 61 // This processInQueue exhausted the queue; shrink it.
68 m_index = 0; 62 m_index = 0;
69 m_queue.resize(0); 63 m_queue.resize(0);
70 m_owner = -1; 64 m_owner = -1;
71 } 65 }
72 } 66 }
73 67
74 void CustomElementCallbackQueue::dispatch(const Invocation& which)
75 {
76 switch (which) {
77 case CustomElementLifecycleCallbacks::Created:
78 m_callbacks->created(m_element.get());
79 break;
80
81 default:
82 ASSERT_NOT_REACHED();
83 }
84 }
85
86 } // namespace WebCore 68 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/CustomElementCallbackQueue.h ('k') | Source/core/dom/CustomElementLifecycleCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698