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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 void CustomElementCallbackScheduler::scheduleCreatedCallback(PassRefPtr<CustomEl
ementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) | 49 void CustomElementCallbackScheduler::scheduleCreatedCallback(PassRefPtr<CustomEl
ementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) |
50 { | 50 { |
51 if (!callbacks->hasCreatedCallback()) | 51 if (!callbacks->hasCreatedCallback()) |
52 return; | 52 return; |
53 | 53 |
54 CustomElementCallbackQueue* queue = instance().scheduleInCurrentElementQueue
(element); | 54 CustomElementCallbackQueue* queue = instance().scheduleInCurrentElementQueue
(element); |
55 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C
ustomElementLifecycleCallbacks::Created)); | 55 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C
ustomElementLifecycleCallbacks::Created)); |
56 } | 56 } |
57 | 57 |
58 void CustomElementCallbackScheduler::scheduleEnteredViewCallback(PassRefPtr<Cust
omElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) | 58 void CustomElementCallbackScheduler::scheduleAttachedCallback(PassRefPtr<CustomE
lementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) |
59 { | 59 { |
60 if (!callbacks->hasEnteredViewCallback()) | 60 if (!callbacks->hasAttachedCallback()) |
61 return; | 61 return; |
62 | 62 |
63 CustomElementCallbackQueue* queue = instance().schedule(element); | 63 CustomElementCallbackQueue* queue = instance().schedule(element); |
64 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C
ustomElementLifecycleCallbacks::EnteredView)); | 64 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C
ustomElementLifecycleCallbacks::Attached)); |
65 } | 65 } |
66 | 66 |
67 void CustomElementCallbackScheduler::scheduleLeftViewCallback(PassRefPtr<CustomE
lementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) | 67 void CustomElementCallbackScheduler::scheduleDetachedCallback(PassRefPtr<CustomE
lementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) |
68 { | 68 { |
69 if (!callbacks->hasLeftViewCallback()) | 69 if (!callbacks->hasDetachedCallback()) |
70 return; | 70 return; |
71 | 71 |
72 CustomElementCallbackQueue* queue = instance().schedule(element); | 72 CustomElementCallbackQueue* queue = instance().schedule(element); |
73 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C
ustomElementLifecycleCallbacks::LeftView)); | 73 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C
ustomElementLifecycleCallbacks::Detached)); |
74 } | 74 } |
75 | 75 |
76 CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance() | 76 CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance() |
77 { | 77 { |
78 DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ()); | 78 DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ()); |
79 return instance; | 79 return instance; |
80 } | 80 } |
81 | 81 |
82 CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue(
PassRefPtr<Element> element) | 82 CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue(
PassRefPtr<Element> element) |
83 { | 83 { |
(...skipping 28 matching lines...) Expand all Loading... |
112 // stack. Because callback queues are processed exhaustively, this | 112 // stack. Because callback queues are processed exhaustively, this |
113 // effectively moves the callback queue to the top of the stack. | 113 // effectively moves the callback queue to the top of the stack. |
114 CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentEle
mentQueue(PassRefPtr<Element> element) | 114 CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentEle
mentQueue(PassRefPtr<Element> element) |
115 { | 115 { |
116 CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element); | 116 CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element); |
117 CustomElementCallbackDispatcher::instance().enqueue(callbackQueue); | 117 CustomElementCallbackDispatcher::instance().enqueue(callbackQueue); |
118 return callbackQueue; | 118 return callbackQueue; |
119 } | 119 } |
120 | 120 |
121 } // namespace WebCore | 121 } // namespace WebCore |
OLD | NEW |