OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 PassRefPtrWillBeRawPtr<MutationObserver> MutationObserver::create(PassOwnPtrWill
BeRawPtr<MutationCallback> callback) | 57 PassRefPtrWillBeRawPtr<MutationObserver> MutationObserver::create(PassOwnPtrWill
BeRawPtr<MutationCallback> callback) |
58 { | 58 { |
59 ASSERT(isMainThread()); | 59 ASSERT(isMainThread()); |
60 return adoptRefWillBeNoop(new MutationObserver(callback)); | 60 return adoptRefWillBeNoop(new MutationObserver(callback)); |
61 } | 61 } |
62 | 62 |
63 MutationObserver::MutationObserver(PassOwnPtrWillBeRawPtr<MutationCallback> call
back) | 63 MutationObserver::MutationObserver(PassOwnPtrWillBeRawPtr<MutationCallback> call
back) |
64 : m_callback(callback) | 64 : m_callback(callback) |
65 , m_priority(s_observerPriority++) | 65 , m_priority(s_observerPriority++) |
66 { | 66 { |
67 #if ENABLE(OILPAN) | |
68 ThreadState::current()->registerPreFinalizer(*this); | |
69 #endif | |
70 } | 67 } |
71 | 68 |
72 MutationObserver::~MutationObserver() | 69 MutationObserver::~MutationObserver() |
73 { | 70 { |
74 #if !ENABLE(OILPAN) | 71 #if !ENABLE(OILPAN) |
75 ASSERT(m_registrations.isEmpty()); | 72 ASSERT(m_registrations.isEmpty()); |
76 dispose(); | |
77 #endif | 73 #endif |
78 } | |
79 | |
80 void MutationObserver::dispose() | |
81 { | |
82 if (!m_records.isEmpty()) | 74 if (!m_records.isEmpty()) |
83 InspectorInstrumentation::didClearAllMutationRecords(m_callback->executi
onContext(), this); | 75 InspectorInstrumentation::didClearAllMutationRecords(m_callback->executi
onContext(), this); |
84 } | 76 } |
85 | 77 |
86 void MutationObserver::observe(Node* node, const MutationObserverInit& observerI
nit, ExceptionState& exceptionState) | 78 void MutationObserver::observe(Node* node, const MutationObserverInit& observerI
nit, ExceptionState& exceptionState) |
87 { | 79 { |
88 if (!node) { | 80 if (!node) { |
89 exceptionState.throwDOMException(NotFoundError, "The provided node was n
ull."); | 81 exceptionState.throwDOMException(NotFoundError, "The provided node was n
ull."); |
90 return; | 82 return; |
91 } | 83 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 { | 276 { |
285 #if ENABLE(OILPAN) | 277 #if ENABLE(OILPAN) |
286 visitor->trace(m_callback); | 278 visitor->trace(m_callback); |
287 visitor->trace(m_records); | 279 visitor->trace(m_records); |
288 visitor->trace(m_registrations); | 280 visitor->trace(m_registrations); |
289 visitor->trace(m_callback); | 281 visitor->trace(m_callback); |
290 #endif | 282 #endif |
291 } | 283 } |
292 | 284 |
293 } // namespace blink | 285 } // namespace blink |
OLD | NEW |