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

Side by Side Diff: third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp

Issue 2673543003: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: Created 3 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 return 0; 408 return 0;
409 return m_requestIdToResourceDataMap.get(requestId); 409 return m_requestIdToResourceDataMap.get(requestId);
410 } 410 }
411 411
412 void NetworkResourcesData::ensureNoDataForRequestId(const String& requestId) { 412 void NetworkResourcesData::ensureNoDataForRequestId(const String& requestId) {
413 ResourceData* resourceData = resourceDataForRequestId(requestId); 413 ResourceData* resourceData = resourceDataForRequestId(requestId);
414 if (!resourceData) 414 if (!resourceData)
415 return; 415 return;
416 if (resourceData->hasContent() || resourceData->hasData()) 416 if (resourceData->hasContent() || resourceData->hasData())
417 m_contentSize -= resourceData->evictContent(); 417 m_contentSize -= resourceData->evictContent();
418 m_requestIdToResourceDataMap.remove(requestId); 418 m_requestIdToResourceDataMap.erase(requestId);
419 } 419 }
420 420
421 bool NetworkResourcesData::ensureFreeSpace(size_t size) { 421 bool NetworkResourcesData::ensureFreeSpace(size_t size) {
422 if (size > m_maximumResourcesContentSize) 422 if (size > m_maximumResourcesContentSize)
423 return false; 423 return false;
424 424
425 while (size > m_maximumResourcesContentSize - m_contentSize) { 425 while (size > m_maximumResourcesContentSize - m_contentSize) {
426 String requestId = m_requestIdsDeque.takeFirst(); 426 String requestId = m_requestIdsDeque.takeFirst();
427 ResourceData* resourceData = resourceDataForRequestId(requestId); 427 ResourceData* resourceData = resourceDataForRequestId(requestId);
428 if (resourceData) 428 if (resourceData)
429 m_contentSize -= resourceData->evictContent(); 429 m_contentSize -= resourceData->evictContent();
430 } 430 }
431 return true; 431 return true;
432 } 432 }
433 433
434 } // namespace blink 434 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698