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

Side by Side Diff: loader/appcache2/ApplicationCacheBridge.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 unified diff | Download patch
« no previous file with comments | « loader/FrameLoader.cpp ('k') | loader/appcache2/ApplicationCacheBridge.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2009, Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef ApplicationCacheBridge_h
32 #define ApplicationCacheBridge_h
33
34 #if ENABLE(APPLICATION_CACHE)
35
36 #include "ApplicationCacheCommon.h"
37 #include "KURL.h"
38 #include <wtf/MessageQueue.h>
39
40 namespace WebCore {
41
42 // This interface is used to by the bridge to call the frontend.
43 class ApplicationCacheBridgeClient {
44 public:
45 virtual ~ApplicationCacheBridgeClient() {}
46
47 // Completion callbacks delivered in response to one of the select cache calls
48 virtual void selectCacheComplete(const GlobalApplicationCacheContextID & contextID,
49 int cacheSequenceNumber,
50 ApplicationCacheStatus status) = 0;
51
52 // Event related callbacks that just happen, not in direct response
53 // to an async method call. These are broadcast to a collection of conte xts.
54 virtual void notifyStatusChanged(const Vector<GlobalApplicationCacheCont extID>& contextIDs,
55 int cacheSequenceNumber,
56 ApplicationCacheStatus statusValue) = 0;
57 virtual void notifyEventListener(const Vector<GlobalApplicationCacheCont extID>& contextIDs,
58 int cacheSequenceNumber,
59 ApplicationCacheEventType eventType) = 0;
60 };
61
62 // The class is used by the frontend to call the backend.
63 class ApplicationCacheBridge {
64 public:
65 ApplicationCacheBridge(ApplicationCacheBridgeClient* client)
66 : m_client(client)
67 {
68 }
69
70 virtual ~ApplicationCacheBridge()
71 {
72 if (m_instance == this)
73 setInstance(0);
74 }
75
76 // The following async methods schedule tasks to be performed in the
77 // backend and return immediately.
78
79 virtual void initializeContextAsync(const GlobalApplicationCacheContextI D &contextID,
80 ApplicationCacheContextType contextT ype,
81 const GlobalApplicationCacheContextI D& parentContextID) = 0;
82 virtual void uninitializeContextAsync(const GlobalApplicationCacheContex tID &contextID) = 0;
83
84 virtual void selectInitialCacheAsync(const GlobalApplicationCacheContext ID &contextID,
85 int cacheSequenceNumber,
86 const KURL& documentURL,
87 ApplicationCacheID cacheDocumentWas LoadedFrom) = 0;
88 virtual void selectCacheWithoutManifestAsync(const GlobalApplicationCach eContextID &contextID,
89 int cacheSequenceNumber,
90 const KURL& documentURL,
91 ApplicationCacheID cacheDoc umentWasLoadedFrom) = 0;
92 virtual void selectCacheWithManifestAsync(const GlobalApplicationCacheCo ntextID &contextID,
93 int cacheSequenceNumber,
94 const KURL& documentURL,
95 ApplicationCacheID cacheDocume ntWasLoadedFrom,
96 const KURL& manifestURLofCache DocumentWasLoadedFrom,
97 const KURL& manifestURL) = 0;
98
99 // The following methods schedule tasks to be performed in the backend
100 // and wait for completion prior to returning.
101
102 virtual ApplicationCacheStatus status(const GlobalApplicationCacheContex tID &contextID) = 0;
103 virtual bool startUpdate(const GlobalApplicationCacheContextID &contextI D) = 0;
104 virtual bool swapCache(const GlobalApplicationCacheContextID &contextID) = 0;
105
106 // The host browser may override the default implementation by creating
107 // a concrete impl in its startup sequence and calling setInstance prior
108 // to constructing any ApplicationCacheFrontend instance. Otherwise,
109 // on the first call to instance(), the default ApplicationCacheBridgeIm pl
110 // will be started up.
111
112 static void setInstance(ApplicationCacheBridge* bridge);
113 static ApplicationCacheBridge* instance();
114
115 protected:
116 ApplicationCacheBridgeClient* m_client;
117 static ApplicationCacheBridge* m_instance;
118 };
119
120 } // namespace WebCore
121
122 #endif // ENABLE(APPLICATION_CACHE)
123 #endif // ApplicationCacheBridge_h
OLDNEW
« no previous file with comments | « loader/FrameLoader.cpp ('k') | loader/appcache2/ApplicationCacheBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698