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

Side by Side Diff: Source/core/fetch/MemoryCache.cpp

Issue 327323002: Start removing the double-negative !ASSERT_DISABLED (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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/editing/TextIterator.cpp ('k') | Source/core/frame/SuspendableTimer.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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 { 338 {
339 ASSERT(accessCount > 0); 339 ASSERT(accessCount > 0);
340 unsigned queueIndex = WTF::fastLog2(size / accessCount); 340 unsigned queueIndex = WTF::fastLog2(size / accessCount);
341 if (m_allResources.size() <= queueIndex) 341 if (m_allResources.size() <= queueIndex)
342 m_allResources.grow(queueIndex + 1); 342 m_allResources.grow(queueIndex + 1);
343 return &m_allResources[queueIndex]; 343 return &m_allResources[queueIndex];
344 } 344 }
345 345
346 void MemoryCache::removeFromLRUList(MemoryCacheEntry* entry, LRUList* list) 346 void MemoryCache::removeFromLRUList(MemoryCacheEntry* entry, LRUList* list)
347 { 347 {
348 #if !ASSERT_DISABLED 348 #if ASSERT_ENABLED
349 // Verify that we are in fact in this list. 349 // Verify that we are in fact in this list.
350 bool found = false; 350 bool found = false;
351 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInAllResourcesList) { 351 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInAllResourcesList) {
352 if (current == entry) { 352 if (current == entry) {
353 found = true; 353 found = true;
354 break; 354 break;
355 } 355 }
356 } 356 }
357 ASSERT(found); 357 ASSERT(found);
358 #endif 358 #endif
(...skipping 19 matching lines...) Expand all
378 ASSERT(!entry->m_nextInAllResourcesList && !entry->m_previousInAllResourcesL ist); 378 ASSERT(!entry->m_nextInAllResourcesList && !entry->m_previousInAllResourcesL ist);
379 379
380 entry->m_nextInAllResourcesList = list->m_head; 380 entry->m_nextInAllResourcesList = list->m_head;
381 list->m_head = entry; 381 list->m_head = entry;
382 382
383 if (entry->m_nextInAllResourcesList) 383 if (entry->m_nextInAllResourcesList)
384 entry->m_nextInAllResourcesList->m_previousInAllResourcesList = entry; 384 entry->m_nextInAllResourcesList->m_previousInAllResourcesList = entry;
385 else 385 else
386 list->m_tail = entry; 386 list->m_tail = entry;
387 387
388 #if !ASSERT_DISABLED 388 #if ASSERT_ENABLED
389 // Verify that we are in now in the list like we should be. 389 // Verify that we are in now in the list like we should be.
390 bool found = false; 390 bool found = false;
391 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInAllResourcesList) { 391 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInAllResourcesList) {
392 if (current == entry) { 392 if (current == entry) {
393 found = true; 393 found = true;
394 break; 394 break;
395 } 395 }
396 } 396 }
397 ASSERT(found); 397 ASSERT(found);
398 #endif 398 #endif
399 } 399 }
400 400
401 void MemoryCache::removeFromLiveDecodedResourcesList(MemoryCacheEntry* entry) 401 void MemoryCache::removeFromLiveDecodedResourcesList(MemoryCacheEntry* entry)
402 { 402 {
403 // If we've never been accessed, then we're brand new and not in any list. 403 // If we've never been accessed, then we're brand new and not in any list.
404 if (!entry->m_inLiveDecodedResourcesList) 404 if (!entry->m_inLiveDecodedResourcesList)
405 return; 405 return;
406 entry->m_inLiveDecodedResourcesList = false; 406 entry->m_inLiveDecodedResourcesList = false;
407 407
408 LRUList* list = &m_liveDecodedResources[entry->m_liveResourcePriority]; 408 LRUList* list = &m_liveDecodedResources[entry->m_liveResourcePriority];
409 409
410 #if !ASSERT_DISABLED 410 #if ASSERT_ENABLED
411 // Verify that we are in fact in this list. 411 // Verify that we are in fact in this list.
412 bool found = false; 412 bool found = false;
413 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInLiveResourcesList) { 413 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInLiveResourcesList) {
414 if (current == entry) { 414 if (current == entry) {
415 found = true; 415 found = true;
416 break; 416 break;
417 } 417 }
418 } 418 }
419 ASSERT(found); 419 ASSERT(found);
420 #endif 420 #endif
(...skipping 23 matching lines...) Expand all
444 444
445 LRUList* list = &m_liveDecodedResources[entry->m_liveResourcePriority]; 445 LRUList* list = &m_liveDecodedResources[entry->m_liveResourcePriority];
446 entry->m_nextInLiveResourcesList = list->m_head; 446 entry->m_nextInLiveResourcesList = list->m_head;
447 if (list->m_head) 447 if (list->m_head)
448 list->m_head->m_previousInLiveResourcesList = entry; 448 list->m_head->m_previousInLiveResourcesList = entry;
449 list->m_head = entry; 449 list->m_head = entry;
450 450
451 if (!entry->m_nextInLiveResourcesList) 451 if (!entry->m_nextInLiveResourcesList)
452 list->m_tail = entry; 452 list->m_tail = entry;
453 453
454 #if !ASSERT_DISABLED 454 #if ASSERT_ENABLED
455 // Verify that we are in now in the list like we should be. 455 // Verify that we are in now in the list like we should be.
456 bool found = false; 456 bool found = false;
457 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInLiveResourcesList) { 457 for (MemoryCacheEntry* current = list->m_head; current; current = current->m _nextInLiveResourcesList) {
458 if (current == entry) { 458 if (current == entry) {
459 found = true; 459 found = true;
460 break; 460 break;
461 } 461 }
462 } 462 }
463 ASSERT(found); 463 ASSERT(found);
464 #endif 464 #endif
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 printf("(%.1fK, %.1fK, %uA, %dR, %d, %d); ", current->decodedSiz e() / 1024.0f, (current->encodedSize() + current->overheadSize()) / 1024.0f, cur rent->accessCount(), current->hasClients(), current->isPurgeable(), current->was Purged()); 719 printf("(%.1fK, %.1fK, %uA, %dR, %d, %d); ", current->decodedSiz e() / 1024.0f, (current->encodedSize() + current->overheadSize()) / 1024.0f, cur rent->accessCount(), current->hasClients(), current->isPurgeable(), current->was Purged());
720 720
721 current = prev; 721 current = prev;
722 } 722 }
723 } 723 }
724 } 724 }
725 725
726 #endif // MEMORY_CACHE_STATS 726 #endif // MEMORY_CACHE_STATS
727 727
728 } // namespace WebCore 728 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/TextIterator.cpp ('k') | Source/core/frame/SuspendableTimer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698