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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 m_host->willStartSubResourceRequest(wrapped); | 157 m_host->willStartSubResourceRequest(wrapped); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC
ache) | 161 void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC
ache) |
162 { | 162 { |
163 ASSERT(!m_domApplicationCache || !domApplicationCache); | 163 ASSERT(!m_domApplicationCache || !domApplicationCache); |
164 m_domApplicationCache = domApplicationCache; | 164 m_domApplicationCache = domApplicationCache; |
165 } | 165 } |
166 | 166 |
| 167 void ApplicationCacheHost::dispose() |
| 168 { |
| 169 // FIXME: Oilpan: remove the dispose step when the owning DocumentLoader |
| 170 // becomes a garbage collected object. Until that time, have the |
| 171 // DocumentLoader dispose and disable this ApplicationCacheHost when |
| 172 // it is finalized. Releasing the WebApplicationCacheHost is needed |
| 173 // to prevent further embedder notifications, which risk accessing an |
| 174 // invalid DocumentLoader. |
| 175 setApplicationCache(0); |
| 176 m_host.clear(); |
| 177 m_documentLoader = nullptr; |
| 178 } |
| 179 |
167 void ApplicationCacheHost::notifyApplicationCache(EventID id, int progressTotal,
int progressDone, WebApplicationCacheHost::ErrorReason errorReason, const Strin
g& errorURL, int errorStatus, const String& errorMessage) | 180 void ApplicationCacheHost::notifyApplicationCache(EventID id, int progressTotal,
int progressDone, WebApplicationCacheHost::ErrorReason errorReason, const Strin
g& errorURL, int errorStatus, const String& errorMessage) |
168 { | 181 { |
169 if (id != PROGRESS_EVENT) | 182 if (id != PROGRESS_EVENT) |
170 InspectorInstrumentation::updateApplicationCacheStatus(m_documentLoader-
>frame()); | 183 InspectorInstrumentation::updateApplicationCacheStatus(m_documentLoader-
>frame()); |
171 | 184 |
172 if (m_defersEvents) { | 185 if (m_defersEvents) { |
173 // Event dispatching is deferred until document.onload has fired. | 186 // Event dispatching is deferred until document.onload has fired. |
174 m_deferredEvents.append(DeferredEvent(id, progressTotal, progressDone, e
rrorReason, errorURL, errorStatus, errorMessage)); | 187 m_deferredEvents.append(DeferredEvent(id, progressTotal, progressDone, e
rrorReason, errorURL, errorStatus, errorMessage)); |
175 return; | 188 return; |
176 } | 189 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 { | 289 { |
277 notifyApplicationCache(ERROR_EVENT, 0, 0, reason, url.string(), status, mess
age); | 290 notifyApplicationCache(ERROR_EVENT, 0, 0, reason, url.string(), status, mess
age); |
278 } | 291 } |
279 | 292 |
280 void ApplicationCacheHost::trace(Visitor* visitor) | 293 void ApplicationCacheHost::trace(Visitor* visitor) |
281 { | 294 { |
282 visitor->trace(m_domApplicationCache); | 295 visitor->trace(m_domApplicationCache); |
283 } | 296 } |
284 | 297 |
285 } // namespace blink | 298 } // namespace blink |
OLD | NEW |