| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include <wtf/CurrentTime.h> | 52 #include <wtf/CurrentTime.h> |
| 53 #include <wtf/text/CString.h> | 53 #include <wtf/text/CString.h> |
| 54 #include <wtf/text/StringConcatenate.h> | 54 #include <wtf/text/StringConcatenate.h> |
| 55 | 55 |
| 56 using namespace std; | 56 using namespace std; |
| 57 | 57 |
| 58 namespace WebCore { | 58 namespace WebCore { |
| 59 | 59 |
| 60 #if PLATFORM(CHROMIUM) || !defined(NDEBUG) | 60 #if PLATFORM(CHROMIUM) || !defined(NDEBUG) |
| 61 | 61 |
| 62 #define PCLOG(...) LOG(PageCache, "%*s%s", indentLevel*4, "", makeString(__VA_AR
GS__).utf8().data()) | 62 #define PCLOG(...) LOG_INFO(PageCache, "%*s%s", indentLevel*4, "", makeString(__
VA_ARGS__).utf8().data()) |
| 63 | 63 |
| 64 // Used in histograms, please only add at the end, and do not remove elements (r
enaming e.g. to "FooEnumUnused1" is fine). | 64 // Used in histograms, please only add at the end, and do not remove elements (r
enaming e.g. to "FooEnumUnused1" is fine). |
| 65 // This is because statistics may be gathered from histograms between versions o
ver time, and re-using values causes collisions. | 65 // This is because statistics may be gathered from histograms between versions o
ver time, and re-using values causes collisions. |
| 66 enum ReasonFrameCannotBeInPageCache { | 66 enum ReasonFrameCannotBeInPageCache { |
| 67 NoDocumentLoader = 0, | 67 NoDocumentLoader = 0, |
| 68 MainDocumentError, | 68 MainDocumentError, |
| 69 IsErrorPage, | 69 IsErrorPage, |
| 70 HasPlugins, | 70 HasPlugins, |
| 71 IsHttpsAndCacheControlled, | 71 IsHttpsAndCacheControlled, |
| 72 HasUnloadListener, | 72 HasUnloadListener, |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 CachedPage* PageCache::get(HistoryItem* item) | 466 CachedPage* PageCache::get(HistoryItem* item) |
| 467 { | 467 { |
| 468 if (!item) | 468 if (!item) |
| 469 return 0; | 469 return 0; |
| 470 | 470 |
| 471 if (CachedPage* cachedPage = item->m_cachedPage.get()) { | 471 if (CachedPage* cachedPage = item->m_cachedPage.get()) { |
| 472 if (!cachedPage->hasExpired()) | 472 if (!cachedPage->hasExpired()) |
| 473 return cachedPage; | 473 return cachedPage; |
| 474 | 474 |
| 475 LOG(PageCache, "Not restoring page for %s from back/forward cache becaus
e cache entry has expired", item->url().string().ascii().data()); | 475 LOG_INFO(PageCache, "Not restoring page for %s from back/forward cache b
ecause cache entry has expired", item->url().string().ascii().data()); |
| 476 pageCache()->remove(item); | 476 pageCache()->remove(item); |
| 477 } | 477 } |
| 478 return 0; | 478 return 0; |
| 479 } | 479 } |
| 480 | 480 |
| 481 void PageCache::remove(HistoryItem* item) | 481 void PageCache::remove(HistoryItem* item) |
| 482 { | 482 { |
| 483 // Safely ignore attempts to remove items not in the cache. | 483 // Safely ignore attempts to remove items not in the cache. |
| 484 if (!item || !item->m_cachedPage) | 484 if (!item || !item->m_cachedPage) |
| 485 return; | 485 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 if (!item->m_prev) { | 528 if (!item->m_prev) { |
| 529 ASSERT(item == m_head); | 529 ASSERT(item == m_head); |
| 530 m_head = item->m_next; | 530 m_head = item->m_next; |
| 531 } else { | 531 } else { |
| 532 ASSERT(item != m_head); | 532 ASSERT(item != m_head); |
| 533 item->m_prev->m_next = item->m_next; | 533 item->m_prev->m_next = item->m_next; |
| 534 } | 534 } |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace WebCore | 537 } // namespace WebCore |
| OLD | NEW |