OLD | NEW |
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 Loading... |
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 |
OLD | NEW |