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

Side by Side Diff: Source/core/loader/appcache/ApplicationCacheHost.h

Issue 552733003: Oilpan: make DOMWindowProperty a GC mixin. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Pacify GC plugin wrt LocalDOMWindow::trace() Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2009, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ApplicationCacheHost_h 31 #ifndef ApplicationCacheHost_h
32 #define ApplicationCacheHost_h 32 #define ApplicationCacheHost_h
33 33
34 #include "platform/heap/Handle.h"
34 #include "platform/weborigin/KURL.h" 35 #include "platform/weborigin/KURL.h"
35 #include "public/platform/WebApplicationCacheHostClient.h" 36 #include "public/platform/WebApplicationCacheHostClient.h"
36 #include "wtf/Deque.h"
37 #include "wtf/OwnPtr.h" 37 #include "wtf/OwnPtr.h"
38 #include "wtf/PassRefPtr.h"
39 #include "wtf/RefPtr.h"
40 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
41 39
42 namespace blink { 40 namespace blink {
43 class ApplicationCache; 41 class ApplicationCache;
44 class DocumentLoader; 42 class DocumentLoader;
45 class LocalFrame; 43 class LocalFrame;
46 class ResourceLoader; 44 class ResourceLoader;
47 class ResourceError; 45 class ResourceError;
48 class ResourceRequest; 46 class ResourceRequest;
49 class ResourceResponse; 47 class ResourceResponse;
50 class SubstituteData; 48 class SubstituteData;
51 49
52 class ApplicationCacheHost : public blink::WebApplicationCacheHostClient { 50 class ApplicationCacheHost FINAL : public NoBaseWillBeGarbageCollectedFinali zed<ApplicationCacheHost>, public WebApplicationCacheHostClient {
53 WTF_MAKE_NONCOPYABLE(ApplicationCacheHost); 51 WTF_MAKE_NONCOPYABLE(ApplicationCacheHost);
54 public: 52 public:
53 static PassOwnPtrWillBeRawPtr<ApplicationCacheHost> create(DocumentLoade r* loader)
54 {
55 return adoptPtrWillBeNoop(new ApplicationCacheHost(loader));
56 }
57 virtual ~ApplicationCacheHost();
58
55 // The Status numeric values are specified in the HTML5 spec. 59 // The Status numeric values are specified in the HTML5 spec.
56 enum Status { 60 enum Status {
57 UNCACHED = 0, 61 UNCACHED = 0,
58 IDLE = 1, 62 IDLE = 1,
59 CHECKING = 2, 63 CHECKING = 2,
60 DOWNLOADING = 3, 64 DOWNLOADING = 3,
61 UPDATEREADY = 4, 65 UPDATEREADY = 4,
62 OBSOLETE = 5 66 OBSOLETE = 5
63 }; 67 };
64 68
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool m_isMaster; 102 bool m_isMaster;
99 bool m_isManifest; 103 bool m_isManifest;
100 bool m_isFallback; 104 bool m_isFallback;
101 bool m_isForeign; 105 bool m_isForeign;
102 bool m_isExplicit; 106 bool m_isExplicit;
103 long long m_size; 107 long long m_size;
104 }; 108 };
105 109
106 typedef Vector<ResourceInfo> ResourceInfoList; 110 typedef Vector<ResourceInfo> ResourceInfoList;
107 111
108 explicit ApplicationCacheHost(DocumentLoader*);
109 virtual ~ApplicationCacheHost();
110
111 void selectCacheWithoutManifest(); 112 void selectCacheWithoutManifest();
112 void selectCacheWithManifest(const KURL& manifestURL); 113 void selectCacheWithManifest(const KURL& manifestURL);
113 114
114 void willStartLoadingMainResource(ResourceRequest&); 115 void willStartLoadingMainResource(ResourceRequest&);
115 void didReceiveResponseForMainResource(const ResourceResponse&); 116 void didReceiveResponseForMainResource(const ResourceResponse&);
116 void mainResourceDataReceived(const char* data, int length); 117 void mainResourceDataReceived(const char* data, int length);
117 void finishedLoadingMainResource(); 118 void finishedLoadingMainResource();
118 void failedLoadingMainResource(); 119 void failedLoadingMainResource();
119 120
120 void willStartLoadingResource(ResourceRequest&); 121 void willStartLoadingResource(ResourceRequest&);
121 122
122 Status status() const; 123 Status status() const;
123 bool update(); 124 bool update();
124 bool swapCache(); 125 bool swapCache();
125 void abort(); 126 void abort();
126 127
127 void setApplicationCache(ApplicationCache*); 128 void setApplicationCache(ApplicationCache*);
128 void notifyApplicationCache(EventID, int progressTotal, int progressDone , blink::WebApplicationCacheHost::ErrorReason, const String& errorURL, int error Status, const String& errorMessage); 129 void notifyApplicationCache(EventID, int progressTotal, int progressDone , WebApplicationCacheHost::ErrorReason, const String& errorURL, int errorStatus, const String& errorMessage);
129 130
130 void stopDeferringEvents(); // Also raises the events that have been que ued up. 131 void stopDeferringEvents(); // Also raises the events that have been que ued up.
131 132
132 void fillResourceList(ResourceInfoList*); 133 void fillResourceList(ResourceInfoList*);
133 CacheInfo applicationCacheInfo(); 134 CacheInfo applicationCacheInfo();
134 135
136 void trace(Visitor*);
137
135 private: 138 private:
139 explicit ApplicationCacheHost(DocumentLoader*);
140
136 // WebApplicationCacheHostClient implementation 141 // WebApplicationCacheHostClient implementation
137 virtual void didChangeCacheAssociation() OVERRIDE FINAL; 142 virtual void didChangeCacheAssociation() OVERRIDE FINAL;
138 virtual void notifyEventListener(blink::WebApplicationCacheHost::EventID ) OVERRIDE FINAL; 143 virtual void notifyEventListener(WebApplicationCacheHost::EventID) OVERR IDE FINAL;
139 virtual void notifyProgressEventListener(const blink::WebURL&, int progr essTotal, int progressDone) OVERRIDE FINAL; 144 virtual void notifyProgressEventListener(const WebURL&, int progressTota l, int progressDone) OVERRIDE FINAL;
140 virtual void notifyErrorEventListener(blink::WebApplicationCacheHost::Er rorReason, const blink::WebURL&, int status, const blink::WebString& message) OV ERRIDE FINAL; 145 virtual void notifyErrorEventListener(WebApplicationCacheHost::ErrorReas on, const WebURL&, int status, const WebString& message) OVERRIDE FINAL;
141 146
142 bool isApplicationCacheEnabled(); 147 bool isApplicationCacheEnabled();
143 DocumentLoader* documentLoader() const { return m_documentLoader; } 148 DocumentLoader* documentLoader() const { return m_documentLoader; }
144 149
145 struct DeferredEvent { 150 struct DeferredEvent {
146 EventID eventID; 151 EventID eventID;
147 int progressTotal; 152 int progressTotal;
148 int progressDone; 153 int progressDone;
149 blink::WebApplicationCacheHost::ErrorReason errorReason; 154 WebApplicationCacheHost::ErrorReason errorReason;
150 String errorURL; 155 String errorURL;
151 int errorStatus; 156 int errorStatus;
152 String errorMessage; 157 String errorMessage;
153 DeferredEvent(EventID id, int progressTotal, int progressDone, blink ::WebApplicationCacheHost::ErrorReason errorReason, const String& errorURL, int errorStatus, const String& errorMessage) 158 DeferredEvent(EventID id, int progressTotal, int progressDone, WebAp plicationCacheHost::ErrorReason errorReason, const String& errorURL, int errorSt atus, const String& errorMessage)
154 : eventID(id) 159 : eventID(id)
155 , progressTotal(progressTotal) 160 , progressTotal(progressTotal)
156 , progressDone(progressDone) 161 , progressDone(progressDone)
157 , errorReason(errorReason) 162 , errorReason(errorReason)
158 , errorURL(errorURL) 163 , errorURL(errorURL)
159 , errorStatus(errorStatus) 164 , errorStatus(errorStatus)
160 , errorMessage(errorMessage) 165 , errorMessage(errorMessage)
161 { 166 {
162 } 167 }
163 }; 168 };
164 169
165 ApplicationCache* m_domApplicationCache; 170 RawPtrWillBeWeakMember<ApplicationCache> m_domApplicationCache;
haraken 2014/09/10 02:49:36 I'm a bit behind. Why is making this a weak member
sof 2014/09/10 05:49:40 If the host outlives the appcache, someone needs t
haraken 2014/09/10 07:46:53 Thanks, makes sense. Can we remove willDestroyGlo
sof 2014/09/10 08:21:37 No. You can still be informed of this if e.g., the
166 DocumentLoader* m_documentLoader; 171 DocumentLoader* m_documentLoader;
167 bool m_defersEvents; // Events are deferred until after document onload. 172 bool m_defersEvents; // Events are deferred until after document onload.
168 Vector<DeferredEvent> m_deferredEvents; 173 Vector<DeferredEvent> m_deferredEvents;
169 174
170 void dispatchDOMEvent(EventID, int progressTotal, int progressDone, blin k::WebApplicationCacheHost::ErrorReason, const String& errorURL, int errorStatus , const String& errorMessage); 175 void dispatchDOMEvent(EventID, int progressTotal, int progressDone, WebA pplicationCacheHost::ErrorReason, const String& errorURL, int errorStatus, const String& errorMessage);
171 176
172 OwnPtr<blink::WebApplicationCacheHost> m_host; 177 OwnPtr<WebApplicationCacheHost> m_host;
173 }; 178 };
174 179
175 } // namespace blink 180 } // namespace blink
176 181
177 #endif // ApplicationCacheHost_h 182 #endif // ApplicationCacheHost_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698