Title: [107596] trunk/Source/WebCore
Revision
107596
Author
[email protected]
Date
2012-02-13 13:07:08 -0800 (Mon, 13 Feb 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=78520 Cleanup PageCache::canCachePageContainingThisFrame readability

Reviewed by Anders Carlsson.

No new tests. (Code cleanup, no change in behavior)

* history/PageCache.cpp:
(WebCore::PageCache::canCachePageContainingThisFrame): Store three commonly
  getter-accessed variables in local variables for readability.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107595 => 107596)


--- trunk/Source/WebCore/ChangeLog	2012-02-13 20:57:46 UTC (rev 107595)
+++ trunk/Source/WebCore/ChangeLog	2012-02-13 21:07:08 UTC (rev 107596)
@@ -1,3 +1,16 @@
+2012-02-13  Brady Eidson  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=78520
+        Cleanup PageCache::canCachePageContainingThisFrame readability
+
+        Reviewed by Anders Carlsson.
+
+        No new tests. (Code cleanup, no change in behavior)
+
+        * history/PageCache.cpp:
+        (WebCore::PageCache::canCachePageContainingThisFrame): Store three commonly
+          getter-accessed variables in local variables for readability.
+
 2012-02-13  Timothy Hatcher  <[email protected]>
 
         Don't include a separator before the "Inspect Element" context menu item when the context menu is empty.

Modified: trunk/Source/WebCore/history/PageCache.cpp (107595 => 107596)


--- trunk/Source/WebCore/history/PageCache.cpp	2012-02-13 20:57:46 UTC (rev 107595)
+++ trunk/Source/WebCore/history/PageCache.cpp	2012-02-13 21:07:08 UTC (rev 107596)
@@ -251,29 +251,33 @@
             return false;
     }
     
-    return frame->loader()->documentLoader()
-        && frame->loader()->documentLoader()->mainDocumentError().isNull()
+    FrameLoader* frameLoader = frame->loader();
+    DocumentLoader* documentLoader = frameLoader->documentLoader();
+    Document* document = frame->document();
+    
+    return documentLoader
+        && documentLoader->mainDocumentError().isNull()
         // Do not cache error pages (these can be recognized as pages with substitute data or unreachable URLs).
-        && !(frame->loader()->documentLoader()->substituteData().isValid() && !frame->loader()->documentLoader()->substituteData().failingURL().isEmpty())
-        && (!frame->loader()->subframeLoader()->containsPlugins() || frame->page()->settings()->pageCacheSupportsPlugins())
-        && !frame->document()->url().protocolIs("https")
+        && !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
+        && (!frameLoader->subframeLoader()->containsPlugins() || frame->page()->settings()->pageCacheSupportsPlugins())
+        && !document->url().protocolIs("https")
         && (!frame->domWindow() || !frame->domWindow()->hasEventListeners(eventNames().unloadEvent))
 #if ENABLE(SQL_DATABASE)
-        && !frame->document()->hasOpenDatabases()
+        && !document->hasOpenDatabases()
 #endif
 #if ENABLE(SHARED_WORKERS)
-        && !SharedWorkerRepository::hasSharedWorkers(frame->document())
+        && !SharedWorkerRepository::hasSharedWorkers(document)
 #endif
-        && !frame->document()->usingGeolocation()
-        && frame->loader()->history()->currentItem()
-        && !frame->loader()->quickRedirectComing()
-        && !frame->loader()->documentLoader()->isLoadingInAPISense()
-        && !frame->loader()->documentLoader()->isStopping()
-        && frame->document()->canSuspendActiveDOMObjects()
+        && !document->usingGeolocation()
+        && frameLoader->history()->currentItem()
+        && !frameLoader->quickRedirectComing()
+        && !documentLoader->isLoadingInAPISense()
+        && !documentLoader->isStopping()
+        && document->canSuspendActiveDOMObjects()
         // FIXME: We should investigating caching frames that have an associated
         // application cache. <rdar://problem/5917899> tracks that work.
-        && frame->loader()->documentLoader()->applicationCacheHost()->canCacheInPageCache()
-        && frame->loader()->client()->canCachePage();
+        && documentLoader->applicationCacheHost()->canCacheInPageCache()
+        && frameLoader->client()->canCachePage();
 }
     
 bool PageCache::canCache(Page* page)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to