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

Side by Side Diff: Source/core/svg/SVGDocumentExtensions.cpp

Issue 327473002: Prepare SVGDocumentExtensions::m_elementDependencies for oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No OwnPtr for maps Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGDocumentExtensions.h ('k') | Source/core/svg/SVGElement.cpp » ('j') | 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) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2007 Rob Buis <buis@kde.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 Element* element = *firstElement; 300 Element* element = *firstElement;
301 301
302 resourceSet->remove(firstElement); 302 resourceSet->remove(firstElement);
303 303
304 if (resourceSet->isEmpty()) 304 if (resourceSet->isEmpty())
305 removePendingResourceForRemoval(id); 305 removePendingResourceForRemoval(id);
306 306
307 return element; 307 return element;
308 } 308 }
309 309
310 HashSet<SVGElement*>* SVGDocumentExtensions::setOfElementsReferencingTarget(SVGE lement* referencedElement) const 310 SVGElementSet* SVGDocumentExtensions::setOfElementsReferencingTarget(SVGElement* referencedElement) const
311 { 311 {
312 ASSERT(referencedElement); 312 ASSERT(referencedElement);
313 const HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::const_iterator i t = m_elementDependencies.find(referencedElement); 313 const ElementDependenciesMap::const_iterator it = m_elementDependencies.find (referencedElement);
314 if (it == m_elementDependencies.end()) 314 if (it == m_elementDependencies.end())
315 return 0; 315 return 0;
316 return it->value.get(); 316 return it->value.get();
317 } 317 }
318 318
319 void SVGDocumentExtensions::addElementReferencingTarget(SVGElement* referencingE lement, SVGElement* referencedElement) 319 void SVGDocumentExtensions::addElementReferencingTarget(SVGElement* referencingE lement, SVGElement* referencedElement)
320 { 320 {
321 ASSERT(referencingElement); 321 ASSERT(referencingElement);
322 ASSERT(referencedElement); 322 ASSERT(referencedElement);
323 323
324 if (HashSet<SVGElement*>* elements = m_elementDependencies.get(referencedEle ment)) { 324 if (SVGElementSet* elements = m_elementDependencies.get(referencedElement)) {
325 elements->add(referencingElement); 325 elements->add(referencingElement);
326 return; 326 return;
327 } 327 }
328 328
329 OwnPtr<HashSet<SVGElement*> > elements = adoptPtr(new HashSet<SVGElement*>); 329 OwnPtrWillBeRawPtr<SVGElementSet> elements = adoptPtrWillBeNoop(new SVGEleme ntSet);
330 elements->add(referencingElement); 330 elements->add(referencingElement);
331 m_elementDependencies.set(referencedElement, elements.release()); 331 m_elementDependencies.set(referencedElement, elements.release());
332 } 332 }
333 333
334 void SVGDocumentExtensions::removeAllTargetReferencesForElement(SVGElement* refe rencingElement) 334 void SVGDocumentExtensions::removeAllTargetReferencesForElement(SVGElement* refe rencingElement)
335 { 335 {
336 Vector<SVGElement*> toBeRemoved; 336 WillBeHeapVector<RawPtrWillBeMember<SVGElement> > toBeRemoved;
337 337
338 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator end = m_eleme ntDependencies.end(); 338 ElementDependenciesMap::iterator end = m_elementDependencies.end();
339 for (HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_e lementDependencies.begin(); it != end; ++it) { 339 for (ElementDependenciesMap::iterator it = m_elementDependencies.begin(); it != end; ++it) {
340 SVGElement* referencedElement = it->key; 340 SVGElement* referencedElement = it->key;
341 HashSet<SVGElement*>* referencingElements = it->value.get(); 341 SVGElementSet* referencingElements = it->value.get();
342 HashSet<SVGElement*>::iterator setIt = referencingElements->find(referen cingElement); 342 SVGElementSet::iterator setIt = referencingElements->find(referencingEle ment);
343 if (setIt == referencingElements->end()) 343 if (setIt == referencingElements->end())
344 continue; 344 continue;
345 345
346 referencingElements->remove(setIt); 346 referencingElements->remove(setIt);
347 if (referencingElements->isEmpty()) 347 if (referencingElements->isEmpty())
348 toBeRemoved.append(referencedElement); 348 toBeRemoved.append(referencedElement);
349 } 349 }
350 350
351 m_elementDependencies.removeAll(toBeRemoved); 351 m_elementDependencies.removeAll(toBeRemoved);
352 } 352 }
353 353
354 void SVGDocumentExtensions::rebuildAllElementReferencesForTarget(SVGElement* ref erencedElement) 354 void SVGDocumentExtensions::rebuildAllElementReferencesForTarget(SVGElement* ref erencedElement)
355 { 355 {
356 ASSERT(referencedElement); 356 ASSERT(referencedElement);
357 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen tDependencies.find(referencedElement); 357 ElementDependenciesMap::iterator it = m_elementDependencies.find(referencedE lement);
358 if (it == m_elementDependencies.end()) 358 if (it == m_elementDependencies.end())
359 return; 359 return;
360 ASSERT(it->key == referencedElement); 360 ASSERT(it->key == referencedElement);
361 Vector<SVGElement*> toBeNotified;
362 361
363 HashSet<SVGElement*>* referencingElements = it->value.get(); 362 WillBeHeapVector<RawPtrWillBeMember<SVGElement> > toBeNotified;
364 HashSet<SVGElement*>::iterator setEnd = referencingElements->end(); 363 SVGElementSet* referencingElements = it->value.get();
365 for (HashSet<SVGElement*>::iterator setIt = referencingElements->begin(); se tIt != setEnd; ++setIt) 364 copyToVector(*referencingElements, toBeNotified);
366 toBeNotified.append(*setIt);
367 365
368 // Force rebuilding the referencingElement so it knows about this change. 366 // Force rebuilding the referencingElement so it knows about this change.
369 Vector<SVGElement*>::iterator vectorEnd = toBeNotified.end(); 367 WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::iterator vectorEnd = toBe Notified.end();
370 for (Vector<SVGElement*>::iterator vectorIt = toBeNotified.begin(); vectorIt != vectorEnd; ++vectorIt) { 368 for (WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::iterator vectorIt = toBeNotified.begin(); vectorIt != vectorEnd; ++vectorIt) {
371 // Before rebuilding referencingElement ensure it was not removed from u nder us. 369 // Before rebuilding referencingElement ensure it was not removed from u nder us.
372 if (HashSet<SVGElement*>* referencingElements = setOfElementsReferencing Target(referencedElement)) { 370 if (SVGElementSet* referencingElements = setOfElementsReferencingTarget( referencedElement)) {
373 if (referencingElements->contains(*vectorIt)) 371 if (referencingElements->contains(*vectorIt))
374 (*vectorIt)->svgAttributeChanged(XLinkNames::hrefAttr); 372 (*vectorIt)->svgAttributeChanged(XLinkNames::hrefAttr);
375 } 373 }
376 } 374 }
377 } 375 }
378 376
379 void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* refe rencedElement) 377 void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* refe rencedElement)
380 { 378 {
381 ASSERT(referencedElement); 379 ASSERT(referencedElement);
382 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen tDependencies.find(referencedElement); 380 ElementDependenciesMap::iterator it = m_elementDependencies.find(referencedE lement);
383 if (it == m_elementDependencies.end()) 381 if (it == m_elementDependencies.end())
384 return; 382 return;
385 ASSERT(it->key == referencedElement); 383 ASSERT(it->key == referencedElement);
386 384
387 m_elementDependencies.remove(it); 385 m_elementDependencies.remove(it);
388 } 386 }
389 387
390 void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents(SVGSVGElemen t* svgRoot) 388 void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents(SVGSVGElemen t* svgRoot)
391 { 389 {
392 ASSERT(!m_inRelativeLengthSVGRootsInvalidation); 390 ASSERT(!m_inRelativeLengthSVGRootsInvalidation);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 471 }
474 472
475 SVGSVGElement* SVGDocumentExtensions::rootElement() const 473 SVGSVGElement* SVGDocumentExtensions::rootElement() const
476 { 474 {
477 ASSERT(m_document); 475 ASSERT(m_document);
478 return rootElement(*m_document); 476 return rootElement(*m_document);
479 } 477 }
480 478
481 void SVGDocumentExtensions::trace(Visitor* visitor) 479 void SVGDocumentExtensions::trace(Visitor* visitor)
482 { 480 {
481 visitor->trace(m_document);
483 visitor->trace(m_timeContainers); 482 visitor->trace(m_timeContainers);
484 visitor->trace(m_svgFontFaceElements); 483 visitor->trace(m_svgFontFaceElements);
485 visitor->trace(m_pendingSVGFontFaceElementsForRemoval); 484 visitor->trace(m_pendingSVGFontFaceElementsForRemoval);
485 visitor->trace(m_elementDependencies);
486 visitor->trace(m_relativeLengthSVGRoots); 486 visitor->trace(m_relativeLengthSVGRoots);
487 } 487 }
488 488
489 } 489 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGDocumentExtensions.h ('k') | Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698