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

Side by Side Diff: Source/core/xml/XPathParser.cpp

Issue 26709019: Vector stores Predicate object as OwnPtr instead of raw pointer in XPath. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/core/xml/XPathParser.h ('k') | Source/core/xml/XPathPath.h » ('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 2005 Maksim Orlovich <maksim@kde.org> 2 * Copyright 2005 Maksim Orlovich <maksim@kde.org>
3 * Copyright (C) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 472
473 Parser* oldParser = currentParser; 473 Parser* oldParser = currentParser;
474 currentParser = this; 474 currentParser = this;
475 int parseError = xpathyyparse(this); 475 int parseError = xpathyyparse(this);
476 currentParser = oldParser; 476 currentParser = oldParser;
477 477
478 if (parseError) { 478 if (parseError) {
479 deleteAllValues(m_parseNodes); 479 deleteAllValues(m_parseNodes);
480 m_parseNodes.clear(); 480 m_parseNodes.clear();
481 481
482 HashSet<Vector<Predicate*>*>::iterator pend = m_predicateVectors.end(); 482 HashSet<Vector<OwnPtr<Predicate> >*>::iterator pend = m_predicateVectors .end();
483 for (HashSet<Vector<Predicate*>*>::iterator it = m_predicateVectors.begi n(); it != pend; ++it) { 483 for (HashSet<Vector<OwnPtr<Predicate> >*>::iterator it = m_predicateVect ors.begin(); it != pend; ++it)
484 deleteAllValues(**it);
485 delete *it; 484 delete *it;
486 }
487 m_predicateVectors.clear(); 485 m_predicateVectors.clear();
488 486
489 HashSet<Vector<OwnPtr<Expression> >*>::iterator eend = m_expressionVecto rs.end(); 487 HashSet<Vector<OwnPtr<Expression> >*>::iterator eend = m_expressionVecto rs.end();
490 for (HashSet<Vector<OwnPtr<Expression> >*>::iterator it = m_expressionVe ctors.begin(); it != eend; ++it) 488 for (HashSet<Vector<OwnPtr<Expression> >*>::iterator it = m_expressionVe ctors.begin(); it != eend; ++it)
491 delete *it; 489 delete *it;
492 m_expressionVectors.clear(); 490 m_expressionVectors.clear();
493 491
494 deleteAllValues(m_strings); 492 deleteAllValues(m_strings);
495 m_strings.clear(); 493 m_strings.clear();
496 494
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 void Parser::unregisterParseNode(ParseNode* node) 531 void Parser::unregisterParseNode(ParseNode* node)
534 { 532 {
535 if (node == 0) 533 if (node == 0)
536 return; 534 return;
537 535
538 ASSERT(m_parseNodes.contains(node)); 536 ASSERT(m_parseNodes.contains(node));
539 537
540 m_parseNodes.remove(node); 538 m_parseNodes.remove(node);
541 } 539 }
542 540
543 void Parser::registerPredicateVector(Vector<Predicate*>* vector) 541 void Parser::registerPredicateVector(Vector<OwnPtr<Predicate> >* vector)
544 { 542 {
545 if (vector == 0) 543 if (vector == 0)
546 return; 544 return;
547 545
548 ASSERT(!m_predicateVectors.contains(vector)); 546 ASSERT(!m_predicateVectors.contains(vector));
549 547
550 m_predicateVectors.add(vector); 548 m_predicateVectors.add(vector);
551 } 549 }
552 550
553 void Parser::deletePredicateVector(Vector<Predicate*>* vector) 551 void Parser::deletePredicateVector(Vector<OwnPtr<Predicate> >* vector)
554 { 552 {
555 if (vector == 0) 553 if (vector == 0)
556 return; 554 return;
557 555
558 ASSERT(m_predicateVectors.contains(vector)); 556 ASSERT(m_predicateVectors.contains(vector));
559 557
560 m_predicateVectors.remove(vector); 558 m_predicateVectors.remove(vector);
561 delete vector; 559 delete vector;
562 } 560 }
563 561
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 { 616 {
619 if (t == 0) 617 if (t == 0)
620 return; 618 return;
621 619
622 ASSERT(m_nodeTests.contains(t)); 620 ASSERT(m_nodeTests.contains(t));
623 621
624 m_nodeTests.remove(t); 622 m_nodeTests.remove(t);
625 delete t; 623 delete t;
626 } 624 }
627 625
OLDNEW
« no previous file with comments | « Source/core/xml/XPathParser.h ('k') | Source/core/xml/XPathPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698