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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 289323003: Move markerlists to Oilpan heap and remove finalizer from DocumentMarkerController (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED Created 6 years, 7 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/rendering/InlineTextBox.cpp ('k') | Source/platform/geometry/IntPoint.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 (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 798
799 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& excepti onState) 799 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& excepti onState)
800 { 800 {
801 if (!node) { 801 if (!node) {
802 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Node")); 802 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Node"));
803 return 0; 803 return 0;
804 } 804 }
805 805
806 // Only TextMatch markers can be active. 806 // Only TextMatch markers can be active.
807 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; 807 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch;
808 Vector<DocumentMarker*> markers = node->document().markers().markersFor(node , markerType); 808 WillBeHeapVector<DocumentMarker*> markers = node->document().markers().marke rsFor(node, markerType);
809 809
810 unsigned activeMarkerCount = 0; 810 unsigned activeMarkerCount = 0;
811 for (Vector<DocumentMarker*>::iterator iter = markers.begin(); iter != marke rs.end(); ++iter) { 811 for (WillBeHeapVector<DocumentMarker*>::iterator iter = markers.begin(); ite r != markers.end(); ++iter) {
812 if ((*iter)->activeMatch()) 812 if ((*iter)->activeMatch())
813 activeMarkerCount++; 813 activeMarkerCount++;
814 } 814 }
815 815
816 return activeMarkerCount; 816 return activeMarkerCount;
817 } 817 }
818 818
819 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& exceptionState) 819 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign ed index, ExceptionState& exceptionState)
820 { 820 {
821 if (!node) { 821 if (!node) {
822 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Node")); 822 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Node"));
823 return 0; 823 return 0;
824 } 824 }
825 825
826 DocumentMarker::MarkerTypes markerTypes = 0; 826 DocumentMarker::MarkerTypes markerTypes = 0;
827 if (!markerTypesFrom(markerType, markerTypes)) { 827 if (!markerTypesFrom(markerType, markerTypes)) {
828 exceptionState.throwDOMException(SyntaxError, "The marker type provided ('" + markerType + "') is invalid."); 828 exceptionState.throwDOMException(SyntaxError, "The marker type provided ('" + markerType + "') is invalid.");
829 return 0; 829 return 0;
830 } 830 }
831 831
832 Vector<DocumentMarker*> markers = node->document().markers().markersFor(node , markerTypes); 832 WillBeHeapVector<DocumentMarker*> markers = node->document().markers().marke rsFor(node, markerTypes);
833 if (markers.size() <= index) 833 if (markers.size() <= index)
834 return 0; 834 return 0;
835 return markers[index]; 835 return markers[index];
836 } 836 }
837 837
838 PassRefPtrWillBeRawPtr<Range> Internals::markerRangeForNode(Node* node, const St ring& markerType, unsigned index, ExceptionState& exceptionState) 838 PassRefPtrWillBeRawPtr<Range> Internals::markerRangeForNode(Node* node, const St ring& markerType, unsigned index, ExceptionState& exceptionState)
839 { 839 {
840 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); 840 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState);
841 if (!marker) 841 if (!marker)
842 return nullptr; 842 return nullptr;
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2328 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2329 { 2329 {
2330 if (!node) 2330 if (!node)
2331 return String(); 2331 return String();
2332 blink::WebPoint point(x, y); 2332 blink::WebPoint point(x, y);
2333 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength); 2333 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2334 return surroundingText.content(); 2334 return surroundingText.content();
2335 } 2335 }
2336 2336
2337 } 2337 }
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineTextBox.cpp ('k') | Source/platform/geometry/IntPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698