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

Side by Side Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 152883002: (Concept patch) Simplify WTF::HashTable::add() return value for size and performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 if (exceptionState.hadException() || !nodeList) 1018 if (exceptionState.hadException() || !nodeList)
1019 continue; 1019 continue;
1020 1020
1021 unsigned size = nodeList->length(); 1021 unsigned size = nodeList->length();
1022 for (unsigned i = 0; i < size; ++i) 1022 for (unsigned i = 0; i < size; ++i)
1023 resultCollector.add(nodeList->item(i)); 1023 resultCollector.add(nodeList->item(i));
1024 } 1024 }
1025 } 1025 }
1026 1026
1027 *searchId = IdentifiersFactory::createIdentifier(); 1027 *searchId = IdentifiersFactory::createIdentifier();
1028 SearchResults::iterator resultsIt = m_searchResults.add(*searchId, Vector<Re fPtr<Node> >()).iterator; 1028 Vector<RefPtr<Node> >* resultsIt = &m_searchResults.add(*searchId, Vector<Re fPtr<Node> >()).iterator->value;
1029 1029
1030 for (ListHashSet<Node*>::iterator it = resultCollector.begin(); it != result Collector.end(); ++it) 1030 for (ListHashSet<Node*>::iterator it = resultCollector.begin(); it != result Collector.end(); ++it)
1031 resultsIt->value.append(*it); 1031 resultsIt->append(*it);
1032 1032
1033 *resultCount = resultsIt->value.size(); 1033 *resultCount = resultsIt->size();
1034 } 1034 }
1035 1035
1036 void InspectorDOMAgent::getSearchResults(ErrorString* errorString, const String& searchId, int fromIndex, int toIndex, RefPtr<TypeBuilder::Array<int> >& nodeIds ) 1036 void InspectorDOMAgent::getSearchResults(ErrorString* errorString, const String& searchId, int fromIndex, int toIndex, RefPtr<TypeBuilder::Array<int> >& nodeIds )
1037 { 1037 {
1038 SearchResults::iterator it = m_searchResults.find(searchId); 1038 SearchResults::iterator it = m_searchResults.find(searchId);
1039 if (it == m_searchResults.end()) { 1039 if (it == m_searchResults.end()) {
1040 *errorString = "No search session with given id found"; 1040 *errorString = "No search session with given id found";
1041 return; 1041 return;
1042 } 1042 }
1043 1043
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 if (!m_documentNodeToIdMap.contains(m_document)) { 2024 if (!m_documentNodeToIdMap.contains(m_document)) {
2025 RefPtr<TypeBuilder::DOM::Node> root; 2025 RefPtr<TypeBuilder::DOM::Node> root;
2026 getDocument(errorString, root); 2026 getDocument(errorString, root);
2027 return errorString->isEmpty(); 2027 return errorString->isEmpty();
2028 } 2028 }
2029 return true; 2029 return true;
2030 } 2030 }
2031 2031
2032 } // namespace WebCore 2032 } // namespace WebCore
2033 2033
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698