Changeset 40286 in webkit
- Timestamp:
- Jan 26, 2009 7:49:43 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r40285 r40286 1 2009-01-26 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin Adler 4 5 -Make the recently added back/forward cache logging much better by actually 6 walking the entire frame tree and indenting the resulting output. 7 -Fix a null-termination bug in HistoryItem tree logging 8 9 * history/HistoryItem.cpp: 10 (WebCore::HistoryItem::showTreeWithIndent): 11 12 * loader/FrameLoader.cpp: 13 (WebCore::pageCacheLogPrefix): 14 (WebCore::pageCacheLog): 15 (WebCore::FrameLoader::logCanCachePageDecision): 16 (WebCore::FrameLoader::logCanCacheFrameDecision): 17 * loader/FrameLoader.h: 18 1 19 2009-01-26 Adam Treat <adam.treat@torchmobile.com> 2 20 -
trunk/WebCore/history/HistoryItem.cpp
r40132 r40286 413 413 for (unsigned i = 0; i < indentLevel; ++i) 414 414 prefix.append(" ", 2); 415 prefix.append("\0", 1); 415 416 416 417 fprintf(stderr, "%s+-%s (%p)\n", prefix.data(), m_urlString.utf8().data(), this); -
trunk/WebCore/loader/FrameLoader.cpp
r40267 r40286 1948 1948 1949 1949 #ifndef NDEBUG 1950 static String& pageCacheLogPrefix(int indentLevel) 1951 { 1952 static int previousIndent = -1; 1953 DEFINE_STATIC_LOCAL(String, prefix, ()); 1954 1955 if (indentLevel != previousIndent) { 1956 previousIndent = indentLevel; 1957 prefix.truncate(0); 1958 for (int i = 0; i < previousIndent; ++i) 1959 prefix += " "; 1960 } 1961 1962 return prefix; 1963 } 1964 1965 static void pageCacheLog(const String& prefix, const String& message) 1966 { 1967 LOG(PageCache, "%s%s", prefix.utf8().data(), message.utf8().data()); 1968 } 1969 1970 #define PCLOG(...) pageCacheLog(pageCacheLogPrefix(indentLevel), String::format(__VA_ARGS__)) 1971 1950 1972 void FrameLoader::logCanCachePageDecision() 1951 1973 { … … 1957 1979 return; 1958 1980 1959 LOG(PageCache, "--------\nDetermining if page can be cached:"); 1960 1961 bool cannotCache = !logCanCacheFrameDecision(); 1962 1963 for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) 1964 cannotCache = !child->loader()->logCanCacheFrameDecision(); 1981 int indentLevel = 0; 1982 PCLOG("--------\n Determining if page can be cached:"); 1983 1984 bool cannotCache = !logCanCacheFrameDecision(1); 1965 1985 1966 1986 FrameLoadType loadType = this->loadType(); 1967 1987 do { 1968 1988 if (m_frame->tree()->parent()) 1969 { LOG(PageCache, "-Frame has a parent frame"); cannotCache = true; }1989 { PCLOG(" -Frame has a parent frame"); cannotCache = true; } 1970 1990 if (!m_frame->page()) { 1971 LOG(PageCache, "-There is no Page object");1991 PCLOG(" -There is no Page object"); 1972 1992 cannotCache = true; 1973 1993 break; 1974 1994 } 1975 1995 if (!m_frame->page()->backForwardList()->enabled()) 1976 { LOG(PageCache, "-The back/forward list is disabled"); cannotCache = true; }1996 { PCLOG(" -The back/forward list is disabled"); cannotCache = true; } 1977 1997 if (!(m_frame->page()->backForwardList()->capacity() > 0)) 1978 { LOG(PageCache, "-The back/forward list has a 0 capacity"); cannotCache = true; }1998 { PCLOG(" -The back/forward list has a 0 capacity"); cannotCache = true; } 1979 1999 if (!m_frame->page()->settings()->usesPageCache()) 1980 { LOG(PageCache, "-Page settings says b/f cache disabled"); cannotCache = true; }2000 { PCLOG(" -Page settings says b/f cache disabled"); cannotCache = true; } 1981 2001 if (loadType == FrameLoadTypeReload) 1982 { LOG(PageCache, "-Load type is: Reload"); cannotCache = true; }2002 { PCLOG(" -Load type is: Reload"); cannotCache = true; } 1983 2003 if (loadType == FrameLoadTypeReloadAllowingStaleData) 1984 { LOG(PageCache, "-Load type is: Reload allowing stale data"); cannotCache = true; }2004 { PCLOG(" -Load type is: Reload allowing stale data"); cannotCache = true; } 1985 2005 if (loadType == FrameLoadTypeReloadFromOrigin) 1986 { LOG(PageCache, "-Load type is: Reload from origin"); cannotCache = true; }2006 { PCLOG(" -Load type is: Reload from origin"); cannotCache = true; } 1987 2007 if (loadType == FrameLoadTypeSame) 1988 { LOG(PageCache, "-Load type is: Same"); cannotCache = true; }2008 { PCLOG(" -Load type is: Same"); cannotCache = true; } 1989 2009 } while (false); 1990 2010 1991 LOG(PageCache, cannotCache ? "Page CANNOT be cached\n--------" : "Page CAN be cached\n--------");1992 } 1993 1994 bool FrameLoader::logCanCacheFrameDecision( )2011 PCLOG(cannotCache ? " Page CANNOT be cached\n--------" : " Page CAN be cached\n--------"); 2012 } 2013 2014 bool FrameLoader::logCanCacheFrameDecision(int indentLevel) 1995 2015 { 1996 2016 // Only bother logging for frames that have actually loaded and have content. … … 2001 2021 return false; 2002 2022 2023 PCLOG("+---"); 2003 2024 KURL newURL = m_provisionalDocumentLoader ? m_provisionalDocumentLoader->url() : KURL(); 2004 2025 if (!newURL.isEmpty()) 2005 LOG(PageCache, "----\nDetermining if frame can be cached navigating from (%s) to (%s):", currentURL.string().utf8().data(), newURL.string().utf8().data());2026 PCLOG(" Determining if frame can be cached navigating from (%s) to (%s):", currentURL.string().utf8().data(), newURL.string().utf8().data()); 2006 2027 else 2007 LOG(PageCache, "----\nDetermining if subframe with URL (%s) can be cached:", currentURL.string().utf8().data());2028 PCLOG(" Determining if subframe with URL (%s) can be cached:", currentURL.string().utf8().data()); 2008 2029 2009 2030 bool cannotCache = false; … … 2011 2032 do { 2012 2033 if (!m_documentLoader) { 2013 LOG(PageCache, "-There is no DocumentLoader object");2034 PCLOG(" -There is no DocumentLoader object"); 2014 2035 cannotCache = true; 2015 2036 break; 2016 2037 } 2017 2038 if (!m_documentLoader->mainDocumentError().isNull()) 2018 { LOG(PageCache, "-Main document has an error"); cannotCache = true; }2039 { PCLOG(" -Main document has an error"); cannotCache = true; } 2019 2040 if (m_frame->tree()->childCount()) 2020 { LOG(PageCache, "-Frame has child frames"); cannotCache = true; }2041 { PCLOG(" -Frame has child frames"); cannotCache = true; } 2021 2042 if (m_containsPlugIns) 2022 { LOG(PageCache, "-Frame contains plugins"); cannotCache = true; }2043 { PCLOG(" -Frame contains plugins"); cannotCache = true; } 2023 2044 if (m_URL.protocolIs("https")) 2024 { LOG(PageCache, "-Frame is HTTPS"); cannotCache = true; }2045 { PCLOG(" -Frame is HTTPS"); cannotCache = true; } 2025 2046 if (!m_frame->document()) { 2026 LOG(PageCache, "-There is no Document object");2047 PCLOG(" -There is no Document object"); 2027 2048 cannotCache = true; 2028 2049 break; 2029 2050 } 2030 2051 if (m_frame->document()->hasWindowEventListener(eventNames().unloadEvent)) 2031 { LOG(PageCache, "-Frame has an unload event listener"); cannotCache = true; }2052 { PCLOG(" -Frame has an unload event listener"); cannotCache = true; } 2032 2053 #if ENABLE(DATABASE) 2033 2054 if (m_frame->document()->hasOpenDatabases()) 2034 { LOG(PageCache, "-Frame has open database handles"); cannotCache = true; }2055 { PCLOG(" -Frame has open database handles"); cannotCache = true; } 2035 2056 #endif 2036 2057 if (m_frame->document()->usingGeolocation()) 2037 { LOG(PageCache, "-Frame uses Geolocation"); cannotCache = true; }2058 { PCLOG(" -Frame uses Geolocation"); cannotCache = true; } 2038 2059 if (!m_currentHistoryItem) 2039 { LOG(PageCache, "-No current history item"); cannotCache = true; }2060 { PCLOG(" -No current history item"); cannotCache = true; } 2040 2061 if (isQuickRedirectComing()) 2041 { LOG(PageCache, "-Quick redirect is coming"); cannotCache = true; }2062 { PCLOG(" -Quick redirect is coming"); cannotCache = true; } 2042 2063 if (m_documentLoader->isLoadingInAPISense()) 2043 { LOG(PageCache, "-DocumentLoader is still loading in API sense"); cannotCache = true; }2064 { PCLOG(" -DocumentLoader is still loading in API sense"); cannotCache = true; } 2044 2065 if (m_documentLoader->isStopping()) 2045 { LOG(PageCache, "-DocumentLoader is in the middle of stopping"); cannotCache = true; }2066 { PCLOG(" -DocumentLoader is in the middle of stopping"); cannotCache = true; } 2046 2067 if (!m_frame->document()->canSuspendActiveDOMObjects()) 2047 { LOG(PageCache, "-The document cannot suspect its active DOM Objects"); cannotCache = true; }2068 { PCLOG(" -The document cannot suspect its active DOM Objects"); cannotCache = true; } 2048 2069 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 2049 2070 if (m_documentLoader->applicationCache()) 2050 { LOG(PageCache, "-The DocumentLoader has an active application cache"); cannotCache = true; }2071 { PCLOG(" -The DocumentLoader has an active application cache"); cannotCache = true; } 2051 2072 if (m_documentLoader->candidateApplicationCacheGroup()) 2052 { LOG(PageCache, "-The DocumentLoader has a candidateApplicationCacheGroup"); cannotCache = true; }2073 { PCLOG(" -The DocumentLoader has a candidateApplicationCacheGroup"); cannotCache = true; } 2053 2074 #endif 2054 2075 if (!m_client->canCachePage()) 2055 { LOG(PageCache, "-The client says this frame cannot be cached"); cannotCache = true; }2076 { PCLOG(" -The client says this frame cannot be cached"); cannotCache = true; } 2056 2077 } while (false); 2057 2058 LOG(PageCache, cannotCache ? "Frame CANNOT be cached\n----" : "Frame CAN be cached\n----"); 2059 2078 2079 for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) 2080 if (!child->loader()->logCanCacheFrameDecision(indentLevel + 1)) 2081 cannotCache = true; 2082 2083 PCLOG(cannotCache ? " Frame CANNOT be cached" : " Frame CAN be cached"); 2084 PCLOG("+---"); 2085 2060 2086 return !cannotCache; 2061 2087 } -
trunk/WebCore/loader/FrameLoader.h
r40012 r40286 461 461 #ifndef NDEBUG 462 462 void logCanCachePageDecision(); 463 bool logCanCacheFrameDecision( );463 bool logCanCacheFrameDecision(int indentLevel); 464 464 #endif 465 465
Note: See TracChangeset
for help on using the changeset viewer.