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

Unified Diff: loader/appcache2/ApplicationCacheFrontend.h

Issue 113554: For local review prior to sending to webkit (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « loader/appcache2/ApplicationCacheCommon.h ('k') | loader/appcache2/ApplicationCacheFrontend.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: loader/appcache2/ApplicationCacheFrontend.h
===================================================================
--- loader/appcache2/ApplicationCacheFrontend.h (revision 0)
+++ loader/appcache2/ApplicationCacheFrontend.h (revision 0)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2009, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ApplicationCacheFrontend_h
+#define ApplicationCacheFrontend_h
+
+#if ENABLE(APPLICATION_CACHE)
+
+#include "ApplicationCacheCommon.h"
+#include "KURL.h"
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+ class ApplicationCacheBridge;
+ class ApplicationCacheBridgeClientImpl;
+ class DOMApplicationCache;
+ class Frame;
+ class ResourceRequest;
+
+ // Each frame and worker has an ApplicationCacheFrontend which serves as a
+ // facade to the actual implmentation which may be running in another process.
+ // FIXME: integrate with the inspector
+ // FIXME: integrate with workers
+ class ApplicationCacheFrontend {
+ public:
+ ApplicationCacheFrontend();
+
+ // Deleted upon frame destruction.
+ ~ApplicationCacheFrontend();
+
+ // Returns the appcache contextID for this instance, each frame is uniquely
+ // identified by this ID.
+ const GlobalApplicationCacheContextID& contextID() const { return m_contextID; }
+
+ // Returns the appcache contextType for this instance
+ ApplicationCacheContextType contextType() const { return m_contextType; }
+
+ // Called during frame creation. Should only be called once.
+ void initializeForFrame(Frame* frame);
+
+ // Called during frame navigation when a new document is committed.
+ void selectInitialCache(const KURL& documentURL,
+ ApplicationCacheID cacheDocumentWasLoadedFrom);
+
+ // Called after parsing of the HTML element is complete, and there was no
+ // manifest attribute.
+ void selectCacheWithoutManifest(const KURL& documentURL,
+ ApplicationCacheID cacheDocumentWasLoadedFrom);
+
+ // Called after parsing of the HTML element is complete, and there was a
+ // manifest attribute. Returns false if the the navigation should be restarted,
+ // this occurs if a 'foriegn' resource was loaded from the cache.
+ bool selectCacheWithManifest(const KURL& documentURL,
+ ApplicationCacheID cacheDocumentWasLoadedFrom,
+ const KURL& manifestURLofCacheDocumentWasLoadedFrom,
+ const KURL& manifestURL);
+
+ // Called by FrameLoader when preparing a resource request associated with this context.
+ void addExtraFieldsToRequest(ResourceRequest& request, bool mainResource);
+
+ // Called by FrameLoader when deciding whether the contents are eligible for the page cache.
+ bool canCacheCurrentDocumentInPageCache() const;
+
+ // Support for the scriptable interface defined by DOMApplicatoinCache.idl
+ ApplicationCacheStatus status() const;
+ bool update();
+ bool swapCache();
+ void setDOMApplicationCache(DOMApplicationCache* client)
+ {
+ ASSERT(!m_DOMApplicationCache || !client);
+ ASSERT(isInitialized());
+ m_DOMApplicationCache = client;
+ }
+
+ protected:
+ // methods for use by the bridge client
+ friend ApplicationCacheBridgeClientImpl;
+
+ // Retrieve the frontend object for a contextID. It is a programming error
+ // to retrieve the object on the wrong thread.
+ static ApplicationCacheFrontend* fromContextID(const GlobalApplicationCacheContextID &contextID);
+
+ // Used by the bridge to prevent sending notification related to a previously selected cache
+ int cacheSequenceNumber() { return m_cacheSequenceNumber; }
+
+ // Called by the backend proxy to notify the frontend of happenings to the underlying
+ // appcache associated with this context.
+ void notifySelectComplete(ApplicationCacheStatus status);
+ void notifyStatusChanged(ApplicationCacheStatus status);
+ void notifyEventListener(ApplicationCacheEventType eventType);
+
+ private:
+ void initialize(ApplicationCacheContextType contextType,
+ const GlobalApplicationCacheContextID& parentContextID);
+
+ bool isInitialized() const { return m_contextID != GlobalApplicationCacheContextID::none(); }
+ int prepareForSelectCall();
+
+ static void addToMap(ApplicationCacheFrontend* frontend);
+ static void removeFromMap(ApplicationCacheFrontend* frontend);
+
+ // System wide unique id for the context.
+ GlobalApplicationCacheContextID m_contextID;
+
+ // The type of context.
+ ApplicationCacheContextType m_contextType;
+
+ // The DOM object thru which we surface events to script.
+ DOMApplicationCache* m_DOMApplicationCache;
+
+ bool m_canCacheInPageCache;
+ bool m_isSelectInProgress;
+ int m_cacheSequenceNumber;
+
+ // We cache this value to avoid round trips to the backend when the
+ // status method is called.
+ mutable bool m_hasCachedStatus;
+ mutable ApplicationCacheStatus m_cachedStatus;
+
+ // Our bridge to the backend.
+ ApplicationCacheBridge* m_bridge;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLICATION_CACHE)
+#endif // ApplicationCacheFrontend_h
Property changes on: loader\appcache2\ApplicationCacheFrontend.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « loader/appcache2/ApplicationCacheCommon.h ('k') | loader/appcache2/ApplicationCacheFrontend.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698