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

Side by Side Diff: third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp

Issue 2415373002: Loading: bulk style errors fix in core/loader (Closed)
Patch Set: Created 4 years, 2 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 | « third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 WrappedResourceRequest wrapped(request); 92 WrappedResourceRequest wrapped(request);
93 93
94 const WebApplicationCacheHost* spawningHost = nullptr; 94 const WebApplicationCacheHost* spawningHost = nullptr;
95 Frame* spawningFrame = frame.tree().parent(); 95 Frame* spawningFrame = frame.tree().parent();
96 if (!spawningFrame || !spawningFrame->isLocalFrame()) 96 if (!spawningFrame || !spawningFrame->isLocalFrame())
97 spawningFrame = frame.loader().opener(); 97 spawningFrame = frame.loader().opener();
98 if (!spawningFrame || !spawningFrame->isLocalFrame()) 98 if (!spawningFrame || !spawningFrame->isLocalFrame())
99 spawningFrame = &frame; 99 spawningFrame = &frame;
100 if (DocumentLoader* spawningDocLoader = 100 if (DocumentLoader* spawningDocLoader =
101 toLocalFrame(spawningFrame)->loader().documentLoader()) 101 toLocalFrame(spawningFrame)->loader().documentLoader()) {
102 spawningHost = spawningDocLoader->applicationCacheHost() 102 spawningHost = spawningDocLoader->applicationCacheHost()
103 ? spawningDocLoader->applicationCacheHost()->m_host.get() 103 ? spawningDocLoader->applicationCacheHost()->m_host.get()
104 : nullptr; 104 : nullptr;
105 }
105 106
106 m_host->willStartMainResourceRequest(wrapped, spawningHost); 107 m_host->willStartMainResourceRequest(wrapped, spawningHost);
107 108
108 // NOTE: The semantics of this method, and others in this interface, are 109 // NOTE: The semantics of this method, and others in this interface, are
109 // subtly different than the method names would suggest. For example, in this 110 // subtly different than the method names would suggest. For example, in this
110 // method never returns an appcached response in the SubstituteData out 111 // method never returns an appcached response in the SubstituteData out
111 // argument, instead we return the appcached response thru the usual resource 112 // argument, instead we return the appcached response thru the usual resource
112 // loading pipeline. 113 // loading pipeline.
113 } 114 }
114 115
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 192 }
192 193
193 void ApplicationCacheHost::notifyApplicationCache( 194 void ApplicationCacheHost::notifyApplicationCache(
194 EventID id, 195 EventID id,
195 int progressTotal, 196 int progressTotal,
196 int progressDone, 197 int progressDone,
197 WebApplicationCacheHost::ErrorReason errorReason, 198 WebApplicationCacheHost::ErrorReason errorReason,
198 const String& errorURL, 199 const String& errorURL,
199 int errorStatus, 200 int errorStatus,
200 const String& errorMessage) { 201 const String& errorMessage) {
201 if (id != kProgressEvent) 202 if (id != kProgressEvent) {
202 InspectorInstrumentation::updateApplicationCacheStatus( 203 InspectorInstrumentation::updateApplicationCacheStatus(
203 m_documentLoader->frame()); 204 m_documentLoader->frame());
205 }
204 206
205 if (m_defersEvents) { 207 if (m_defersEvents) {
206 // Event dispatching is deferred until document.onload has fired. 208 // Event dispatching is deferred until document.onload has fired.
207 m_deferredEvents.append(DeferredEvent(id, progressTotal, progressDone, 209 m_deferredEvents.append(DeferredEvent(id, progressTotal, progressDone,
208 errorReason, errorURL, errorStatus, 210 errorReason, errorURL, errorStatus,
209 errorMessage)); 211 errorMessage));
210 return; 212 return;
211 } 213 }
212 dispatchDOMEvent(id, progressTotal, progressDone, errorReason, errorURL, 214 dispatchDOMEvent(id, progressTotal, progressDone, errorReason, errorURL,
213 errorStatus, errorMessage); 215 errorStatus, errorMessage);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 const String& errorURL, 260 const String& errorURL,
259 int errorStatus, 261 int errorStatus,
260 const String& errorMessage) { 262 const String& errorMessage) {
261 if (!m_domApplicationCache) 263 if (!m_domApplicationCache)
262 return; 264 return;
263 265
264 const AtomicString& eventType = ApplicationCache::toEventType(id); 266 const AtomicString& eventType = ApplicationCache::toEventType(id);
265 if (eventType.isEmpty() || !m_domApplicationCache->getExecutionContext()) 267 if (eventType.isEmpty() || !m_domApplicationCache->getExecutionContext())
266 return; 268 return;
267 Event* event = nullptr; 269 Event* event = nullptr;
268 if (id == kProgressEvent) 270 if (id == kProgressEvent) {
269 event = ProgressEvent::create(eventType, true, progressDone, progressTotal); 271 event = ProgressEvent::create(eventType, true, progressDone, progressTotal);
270 else if (id == kErrorEvent) 272 } else if (id == kErrorEvent) {
271 event = ApplicationCacheErrorEvent::create(errorReason, errorURL, 273 event = ApplicationCacheErrorEvent::create(errorReason, errorURL,
272 errorStatus, errorMessage); 274 errorStatus, errorMessage);
273 else 275 } else {
274 event = Event::create(eventType); 276 event = Event::create(eventType);
277 }
275 m_domApplicationCache->dispatchEvent(event); 278 m_domApplicationCache->dispatchEvent(event);
276 } 279 }
277 280
278 ApplicationCacheHost::Status ApplicationCacheHost::getStatus() const { 281 ApplicationCacheHost::Status ApplicationCacheHost::getStatus() const {
279 return m_host ? static_cast<Status>(m_host->getStatus()) : kUncached; 282 return m_host ? static_cast<Status>(m_host->getStatus()) : kUncached;
280 } 283 }
281 284
282 bool ApplicationCacheHost::update() { 285 bool ApplicationCacheHost::update() {
283 return m_host ? m_host->startUpdate() : false; 286 return m_host ? m_host->startUpdate() : false;
284 } 287 }
285 288
286 bool ApplicationCacheHost::swapCache() { 289 bool ApplicationCacheHost::swapCache() {
287 bool success = m_host ? m_host->swapCache() : false; 290 bool success = m_host ? m_host->swapCache() : false;
288 if (success) 291 if (success) {
289 InspectorInstrumentation::updateApplicationCacheStatus( 292 InspectorInstrumentation::updateApplicationCacheStatus(
290 m_documentLoader->frame()); 293 m_documentLoader->frame());
294 }
291 return success; 295 return success;
292 } 296 }
293 297
294 void ApplicationCacheHost::abort() { 298 void ApplicationCacheHost::abort() {
295 if (m_host) 299 if (m_host)
296 m_host->abort(); 300 m_host->abort();
297 } 301 }
298 302
299 bool ApplicationCacheHost::isApplicationCacheEnabled() { 303 bool ApplicationCacheHost::isApplicationCacheEnabled() {
300 DCHECK(m_documentLoader->frame()); 304 DCHECK(m_documentLoader->frame());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 notifyApplicationCache(kErrorEvent, 0, 0, reason, url.string(), status, 336 notifyApplicationCache(kErrorEvent, 0, 0, reason, url.string(), status,
333 message); 337 message);
334 } 338 }
335 339
336 DEFINE_TRACE(ApplicationCacheHost) { 340 DEFINE_TRACE(ApplicationCacheHost) {
337 visitor->trace(m_domApplicationCache); 341 visitor->trace(m_domApplicationCache);
338 visitor->trace(m_documentLoader); 342 visitor->trace(m_documentLoader);
339 } 343 }
340 344
341 } // namespace blink 345 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698