OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 { | 39 { |
40 m_queue.append(step); | 40 m_queue.append(step); |
41 } | 41 } |
42 | 42 |
43 CustomElementMicrotaskStep::Result CustomElementMicrotaskQueue::dispatch() | 43 CustomElementMicrotaskStep::Result CustomElementMicrotaskQueue::dispatch() |
44 { | 44 { |
45 Result result = Result(0); | 45 Result result = Result(0); |
46 | 46 |
47 unsigned i; | 47 unsigned i; |
48 for (i = 0; i < m_queue.size(); ++i) { | 48 for (i = 0; i < m_queue.size(); ++i) { |
49 // The created callback may schedule entered document | |
50 // callbacks. | |
51 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | |
52 result = Result(result | m_queue[i]->process()); | 49 result = Result(result | m_queue[i]->process()); |
53 | 50 |
54 if (result & CustomElementMicrotaskStep::ShouldStop) | 51 if (result & CustomElementMicrotaskStep::ShouldStop) |
55 break; | 52 break; |
56 } | 53 } |
57 | 54 |
58 bool wasStopped = i < m_queue.size(); | 55 bool wasStopped = i < m_queue.size(); |
59 if (wasStopped) | 56 if (wasStopped) |
60 m_queue.remove(0, i); | 57 m_queue.remove(0, i); |
61 else | 58 else |
62 m_queue.resize(0); | 59 m_queue.resize(0); |
63 | 60 |
64 return result; | 61 return result; |
65 } | 62 } |
66 | 63 |
67 } // namespace WebCore | 64 } // namespace WebCore |
OLD | NEW |