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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 oldMap[oldIndex].second = newIndex; 237 oldMap[oldIndex].second = newIndex;
238 newMap[newIndex].first = newList[newIndex].get(); 238 newMap[newIndex].first = newList[newIndex].get();
239 newMap[newIndex].second = oldIndex; 239 newMap[newIndex].second = oldIndex;
240 } 240 }
241 241
242 typedef HashMap<String, Vector<size_t> > DiffTable; 242 typedef HashMap<String, Vector<size_t> > DiffTable;
243 DiffTable newTable; 243 DiffTable newTable;
244 DiffTable oldTable; 244 DiffTable oldTable;
245 245
246 for (size_t i = 0; i < newList.size(); ++i) { 246 for (size_t i = 0; i < newList.size(); ++i) {
247 DiffTable::iterator it = newTable.add(newList[i]->m_sha1, Vector<size_t> ()).iterator; 247 newTable.add(newList[i]->m_sha1, Vector<size_t>()).storedValue->value.ap pend(i);
248 it->value.append(i);
249 } 248 }
250 249
251 for (size_t i = 0; i < oldList.size(); ++i) { 250 for (size_t i = 0; i < oldList.size(); ++i) {
252 DiffTable::iterator it = oldTable.add(oldList[i]->m_sha1, Vector<size_t> ()).iterator; 251 oldTable.add(oldList[i]->m_sha1, Vector<size_t>()).storedValue->value.ap pend(i);
253 it->value.append(i);
254 } 252 }
255 253
256 for (DiffTable::iterator newIt = newTable.begin(); newIt != newTable.end(); ++newIt) { 254 for (DiffTable::iterator newIt = newTable.begin(); newIt != newTable.end(); ++newIt) {
257 if (newIt->value.size() != 1) 255 if (newIt->value.size() != 1)
258 continue; 256 continue;
259 257
260 DiffTable::iterator oldIt = oldTable.find(newIt->key); 258 DiffTable::iterator oldIt = oldTable.find(newIt->key);
261 if (oldIt == oldTable.end() || oldIt->value.size() != 1) 259 if (oldIt == oldTable.end() || oldIt->value.size() != 1)
262 continue; 260 continue;
263 261
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 506 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
509 { 507 {
510 fprintf(stderr, "\n\n"); 508 fprintf(stderr, "\n\n");
511 for (size_t i = 0; i < map.size(); ++i) 509 for (size_t i = 0; i < map.size(); ++i)
512 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second); 510 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second);
513 } 511 }
514 #endif 512 #endif
515 513
516 } // namespace WebCore 514 } // namespace WebCore
517 515
OLDNEW
« no previous file with comments | « Source/core/inspector/AsyncCallStackTracker.cpp ('k') | Source/core/inspector/InspectorConsoleAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698