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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 1463433002: Use RefPtr for MutationObserver in MutationObserverInterestGroup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the test Created 5 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 { 1849 {
1850 if (!hasRareData()) 1850 if (!hasRareData())
1851 return nullptr; 1851 return nullptr;
1852 NodeMutationObserverData* data = rareData()->mutationObserverData(); 1852 NodeMutationObserverData* data = rareData()->mutationObserverData();
1853 if (!data) 1853 if (!data)
1854 return nullptr; 1854 return nullptr;
1855 return &data->transientRegistry; 1855 return &data->transientRegistry;
1856 } 1856 }
1857 1857
1858 template<typename Registry> 1858 template<typename Registry>
1859 static inline void collectMatchingObserversForMutation(WillBeHeapHashMap<RawPtrW illBeMember<MutationObserver>, MutationRecordDeliveryOptions>& observers, Regist ry* registry, Node& target, MutationObserver::MutationType type, const Qualified Name* attributeName) 1859 static inline void collectMatchingObserversForMutation(WillBeHeapHashMap<RefPtrW illBeMember<MutationObserver>, MutationRecordDeliveryOptions>& observers, Regist ry* registry, Node& target, MutationObserver::MutationType type, const Qualified Name* attributeName)
1860 { 1860 {
1861 if (!registry) 1861 if (!registry)
1862 return; 1862 return;
1863 1863
1864 for (const auto& registration : *registry) { 1864 for (const auto& registration : *registry) {
1865 if (registration->shouldReceiveMutationFrom(target, type, attributeName) ) { 1865 if (registration->shouldReceiveMutationFrom(target, type, attributeName) ) {
1866 MutationRecordDeliveryOptions deliveryOptions = registration->delive ryOptions(); 1866 MutationRecordDeliveryOptions deliveryOptions = registration->delive ryOptions();
1867 WillBeHeapHashMap<RawPtrWillBeMember<MutationObserver>, MutationReco rdDeliveryOptions>::AddResult result = observers.add(&registration->observer(), deliveryOptions); 1867 WillBeHeapHashMap<RefPtrWillBeMember<MutationObserver>, MutationReco rdDeliveryOptions>::AddResult result = observers.add(&registration->observer(), deliveryOptions);
1868 if (!result.isNewEntry) 1868 if (!result.isNewEntry)
1869 result.storedValue->value |= deliveryOptions; 1869 result.storedValue->value |= deliveryOptions;
1870 } 1870 }
1871 } 1871 }
1872 } 1872 }
1873 1873
1874 void Node::getRegisteredMutationObserversOfType(WillBeHeapHashMap<RawPtrWillBeMe mber<MutationObserver>, MutationRecordDeliveryOptions>& observers, MutationObser ver::MutationType type, const QualifiedName* attributeName) 1874 void Node::getRegisteredMutationObserversOfType(WillBeHeapHashMap<RefPtrWillBeMe mber<MutationObserver>, MutationRecordDeliveryOptions>& observers, MutationObser ver::MutationType type, const QualifiedName* attributeName)
1875 { 1875 {
1876 ASSERT((type == MutationObserver::Attributes && attributeName) || !attribute Name); 1876 ASSERT((type == MutationObserver::Attributes && attributeName) || !attribute Name);
1877 collectMatchingObserversForMutation(observers, mutationObserverRegistry(), * this, type, attributeName); 1877 collectMatchingObserversForMutation(observers, mutationObserverRegistry(), * this, type, attributeName);
1878 collectMatchingObserversForMutation(observers, transientMutationObserverRegi stry(), *this, type, attributeName); 1878 collectMatchingObserversForMutation(observers, transientMutationObserverRegi stry(), *this, type, attributeName);
1879 ScriptForbiddenScope forbidScriptDuringRawIteration; 1879 ScriptForbiddenScope forbidScriptDuringRawIteration;
1880 for (Node* node = parentNode(); node; node = node->parentNode()) { 1880 for (Node* node = parentNode(); node; node = node->parentNode()) {
1881 collectMatchingObserversForMutation(observers, node->mutationObserverReg istry(), *this, type, attributeName); 1881 collectMatchingObserversForMutation(observers, node->mutationObserverReg istry(), *this, type, attributeName);
1882 collectMatchingObserversForMutation(observers, node->transientMutationOb serverRegistry(), *this, type, attributeName); 1882 collectMatchingObserversForMutation(observers, node->transientMutationOb serverRegistry(), *this, type, attributeName);
1883 } 1883 }
1884 } 1884 }
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 2368
2369 void showNodePath(const blink::Node* node) 2369 void showNodePath(const blink::Node* node)
2370 { 2370 {
2371 if (node) 2371 if (node)
2372 node->showNodePathForThis(); 2372 node->showNodePathForThis();
2373 else 2373 else
2374 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2374 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2375 } 2375 }
2376 2376
2377 #endif 2377 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698