| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 // We provide a custom implementation of this class that calls out to the | 61 // We provide a custom implementation of this class that calls out to the |
| 62 // embedding application instead of using WebCore's built in appcache system. | 62 // embedding application instead of using WebCore's built in appcache system. |
| 63 // This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build. | 63 // This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build. |
| 64 | 64 |
| 65 ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader) | 65 ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader) |
| 66 : m_domApplicationCache(nullptr) | 66 : m_domApplicationCache(nullptr) |
| 67 , m_documentLoader(documentLoader) | 67 , m_documentLoader(documentLoader) |
| 68 , m_defersEvents(true) | 68 , m_defersEvents(true) |
| 69 { | 69 { |
| 70 ASSERT(m_documentLoader); | 70 DCHECK(m_documentLoader); |
| 71 } | 71 } |
| 72 | 72 |
| 73 ApplicationCacheHost::~ApplicationCacheHost() | 73 ApplicationCacheHost::~ApplicationCacheHost() |
| 74 { | 74 { |
| 75 // Verify that detachFromDocumentLoader() has been performed already. | 75 // Verify that detachFromDocumentLoader() has been performed already. |
| 76 ASSERT(!m_host); | 76 DCHECK(!m_host); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void ApplicationCacheHost::willStartLoadingMainResource(ResourceRequest& request
) | 79 void ApplicationCacheHost::willStartLoadingMainResource(ResourceRequest& request
) |
| 80 { | 80 { |
| 81 // We defer creating the outer host object to avoid spurious creation/destru
ction | 81 // We defer creating the outer host object to avoid spurious creation/destru
ction |
| 82 // around creating empty documents. At this point, we're initiating a main r
esource | 82 // around creating empty documents. At this point, we're initiating a main r
esource |
| 83 // load for the document, so its for real. | 83 // load for the document, so its for real. |
| 84 | 84 |
| 85 if (!isApplicationCacheEnabled()) | 85 if (!isApplicationCacheEnabled()) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 ASSERT(m_documentLoader->frame()); | 88 DCHECK(m_documentLoader->frame()); |
| 89 LocalFrame& frame = *m_documentLoader->frame(); | 89 LocalFrame& frame = *m_documentLoader->frame(); |
| 90 m_host = frame.loader().client()->createApplicationCacheHost(this); | 90 m_host = frame.loader().client()->createApplicationCacheHost(this); |
| 91 if (!m_host) | 91 if (!m_host) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 WrappedResourceRequest wrapped(request); | 94 WrappedResourceRequest wrapped(request); |
| 95 | 95 |
| 96 const WebApplicationCacheHost* spawningHost = nullptr; | 96 const WebApplicationCacheHost* spawningHost = nullptr; |
| 97 Frame* spawningFrame = frame.tree().parent(); | 97 Frame* spawningFrame = frame.tree().parent(); |
| 98 if (!spawningFrame || !spawningFrame->isLocalFrame()) | 98 if (!spawningFrame || !spawningFrame->isLocalFrame()) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 void ApplicationCacheHost::willStartLoadingResource(ResourceRequest& request) | 169 void ApplicationCacheHost::willStartLoadingResource(ResourceRequest& request) |
| 170 { | 170 { |
| 171 if (m_host) { | 171 if (m_host) { |
| 172 WrappedResourceRequest wrapped(request); | 172 WrappedResourceRequest wrapped(request); |
| 173 m_host->willStartSubResourceRequest(wrapped); | 173 m_host->willStartSubResourceRequest(wrapped); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC
ache) | 177 void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC
ache) |
| 178 { | 178 { |
| 179 ASSERT(!m_domApplicationCache || !domApplicationCache); | 179 DCHECK(!m_domApplicationCache || !domApplicationCache); |
| 180 m_domApplicationCache = domApplicationCache; | 180 m_domApplicationCache = domApplicationCache; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ApplicationCacheHost::detachFromDocumentLoader() | 183 void ApplicationCacheHost::detachFromDocumentLoader() |
| 184 { | 184 { |
| 185 // Detach from the owning DocumentLoader and let go of WebApplicationCacheHo
st. | 185 // Detach from the owning DocumentLoader and let go of WebApplicationCacheHo
st. |
| 186 setApplicationCache(nullptr); | 186 setApplicationCache(nullptr); |
| 187 m_host.reset(); | 187 m_host.reset(); |
| 188 m_documentLoader = nullptr; | 188 m_documentLoader = nullptr; |
| 189 } | 189 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 | 273 |
| 274 void ApplicationCacheHost::abort() | 274 void ApplicationCacheHost::abort() |
| 275 { | 275 { |
| 276 if (m_host) | 276 if (m_host) |
| 277 m_host->abort(); | 277 m_host->abort(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 bool ApplicationCacheHost::isApplicationCacheEnabled() | 280 bool ApplicationCacheHost::isApplicationCacheEnabled() |
| 281 { | 281 { |
| 282 ASSERT(m_documentLoader->frame()); | 282 DCHECK(m_documentLoader->frame()); |
| 283 return m_documentLoader->frame()->settings() && m_documentLoader->frame()->s
ettings()->offlineWebApplicationCacheEnabled(); | 283 return m_documentLoader->frame()->settings() && m_documentLoader->frame()->s
ettings()->offlineWebApplicationCacheEnabled(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void ApplicationCacheHost::didChangeCacheAssociation() | 286 void ApplicationCacheHost::didChangeCacheAssociation() |
| 287 { | 287 { |
| 288 // FIXME: Prod the inspector to update its notion of what cache the page is
using. | 288 // FIXME: Prod the inspector to update its notion of what cache the page is
using. |
| 289 } | 289 } |
| 290 | 290 |
| 291 void ApplicationCacheHost::notifyEventListener(WebApplicationCacheHost::EventID
eventID) | 291 void ApplicationCacheHost::notifyEventListener(WebApplicationCacheHost::EventID
eventID) |
| 292 { | 292 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 303 notifyApplicationCache(kErrorEvent, 0, 0, reason, url.string(), status, mess
age); | 303 notifyApplicationCache(kErrorEvent, 0, 0, reason, url.string(), status, mess
age); |
| 304 } | 304 } |
| 305 | 305 |
| 306 DEFINE_TRACE(ApplicationCacheHost) | 306 DEFINE_TRACE(ApplicationCacheHost) |
| 307 { | 307 { |
| 308 visitor->trace(m_domApplicationCache); | 308 visitor->trace(m_domApplicationCache); |
| 309 visitor->trace(m_documentLoader); | 309 visitor->trace(m_documentLoader); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace blink | 312 } // namespace blink |
| OLD | NEW |