| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 CustomElementCallbackQueue::CustomElementCallbackQueue(RawPtr<Element> element) | 42 CustomElementCallbackQueue::CustomElementCallbackQueue(RawPtr<Element> element) |
| 43 : m_element(element) | 43 : m_element(element) |
| 44 , m_owner(-1) | 44 , m_owner(-1) |
| 45 , m_index(0) | 45 , m_index(0) |
| 46 , m_inCreatedCallback(false) | 46 , m_inCreatedCallback(false) |
| 47 { | 47 { |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool CustomElementCallbackQueue::processInElementQueue(ElementQueueId caller) | 50 bool CustomElementCallbackQueue::processInElementQueue(ElementQueueId caller) |
| 51 { | 51 { |
| 52 ASSERT(!m_inCreatedCallback); | 52 DCHECK(!m_inCreatedCallback); |
| 53 bool didWork = false; | 53 bool didWork = false; |
| 54 | 54 |
| 55 // Never run custom element callbacks in UA shadow roots since that would | 55 // Never run custom element callbacks in UA shadow roots since that would |
| 56 // leak the UA root and it's elements into the page. | 56 // leak the UA root and it's elements into the page. |
| 57 ShadowRoot* shadowRoot = m_element->containingShadowRoot(); | 57 ShadowRoot* shadowRoot = m_element->containingShadowRoot(); |
| 58 if (!shadowRoot || shadowRoot->type() != ShadowRootType::UserAgent) { | 58 if (!shadowRoot || shadowRoot->type() != ShadowRootType::UserAgent) { |
| 59 while (m_index < m_queue.size() && owner() == caller) { | 59 while (m_index < m_queue.size() && owner() == caller) { |
| 60 m_inCreatedCallback = m_queue[m_index]->isCreatedCallback(); | 60 m_inCreatedCallback = m_queue[m_index]->isCreatedCallback(); |
| 61 | 61 |
| 62 // dispatch() may cause recursion which steals this callback | 62 // dispatch() may cause recursion which steals this callback |
| (...skipping 15 matching lines...) Expand all Loading... |
| 78 return didWork; | 78 return didWork; |
| 79 } | 79 } |
| 80 | 80 |
| 81 DEFINE_TRACE(CustomElementCallbackQueue) | 81 DEFINE_TRACE(CustomElementCallbackQueue) |
| 82 { | 82 { |
| 83 visitor->trace(m_element); | 83 visitor->trace(m_element); |
| 84 visitor->trace(m_queue); | 84 visitor->trace(m_queue); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |