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: Source/core/loader/ResourceLoader.cpp

Issue 19574002: Refactoring: Introduce ResouceLoaderHost interface for unloading ResourceLoader. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another attempt Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/ResourceLoader.h ('k') | Source/core/loader/ResourceLoaderHost.h » ('j') | 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) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 13 matching lines...) Expand all
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/loader/ResourceLoader.h" 31 #include "core/loader/ResourceLoader.h"
32 32
33 #include "core/inspector/InspectorInstrumentation.h" 33 #include "core/inspector/InspectorInstrumentation.h"
34 #include "core/loader/DocumentLoader.h" 34 #include "core/loader/ResourceLoaderHost.h"
35 #include "core/loader/FrameLoader.h"
36 #include "core/loader/FrameLoaderClient.h"
37 #include "core/loader/appcache/ApplicationCacheHost.h"
38 #include "core/loader/cache/CachedResourceLoader.h"
39 #include "core/page/Frame.h"
40 #include "core/page/Page.h" 35 #include "core/page/Page.h"
41 #include "core/platform/Logging.h" 36 #include "core/platform/Logging.h"
42 #include "core/platform/network/ResourceError.h" 37 #include "core/platform/network/ResourceError.h"
43 #include "core/platform/network/ResourceHandle.h" 38 #include "core/platform/network/ResourceHandle.h"
44 39
45 namespace WebCore { 40 namespace WebCore {
46 41
47 ResourceLoader::RequestCountTracker::RequestCountTracker(CachedResourceLoader* c achedResourceLoader, CachedResource* resource) 42 ResourceLoader::RequestCountTracker::RequestCountTracker(ResourceLoaderHost* hos t, CachedResource* resource)
48 : m_cachedResourceLoader(cachedResourceLoader) 43 : m_host(host)
49 , m_resource(resource) 44 , m_resource(resource)
50 { 45 {
51 m_cachedResourceLoader->incrementRequestCount(m_resource); 46 m_host->incrementRequestCount(m_resource);
52 } 47 }
53 48
54 ResourceLoader::RequestCountTracker::~RequestCountTracker() 49 ResourceLoader::RequestCountTracker::~RequestCountTracker()
55 { 50 {
56 m_cachedResourceLoader->decrementRequestCount(m_resource); 51 m_host->decrementRequestCount(m_resource);
57 } 52 }
58 53
59 PassRefPtr<ResourceLoader> ResourceLoader::create(DocumentLoader* documentLoader , CachedResource* resource, const ResourceRequest& request, const ResourceLoader Options& options) 54 PassRefPtr<ResourceLoader> ResourceLoader::create(ResourceLoaderHost* host, Cach edResource* resource, const ResourceRequest& request, const ResourceLoaderOption s& options)
60 { 55 {
61 RefPtr<ResourceLoader> loader(adoptRef(new ResourceLoader(documentLoader, re source, options))); 56 RefPtr<ResourceLoader> loader(adoptRef(new ResourceLoader(host, resource, op tions)));
62 if (!loader->init(request)) 57 if (!loader->init(request))
63 return 0; 58 return 0;
64 loader->start(); 59 loader->start();
65 return loader.release(); 60 return loader.release();
66 } 61 }
67 62
68 ResourceLoader::ResourceLoader(DocumentLoader* documentLoader, CachedResource* r esource, ResourceLoaderOptions options) 63 ResourceLoader::ResourceLoader(ResourceLoaderHost* host, CachedResource* resourc e, const ResourceLoaderOptions& options)
69 : m_frame(documentLoader->frame()) 64 : m_host(host)
70 , m_documentLoader(documentLoader)
71 , m_loadingMultipartContent(false) 65 , m_loadingMultipartContent(false)
72 , m_notifiedLoadComplete(false) 66 , m_notifiedLoadComplete(false)
73 , m_defersLoading(m_frame->page()->defersLoading()) 67 , m_defersLoading(host->defersLoading())
74 , m_options(options) 68 , m_options(options)
75 , m_resource(resource) 69 , m_resource(resource)
76 , m_state(Uninitialized) 70 , m_state(Uninitialized)
77 , m_requestCountTracker(adoptPtr(new RequestCountTracker(documentLoader->cac hedResourceLoader(), resource))) 71 , m_requestCountTracker(adoptPtr(new RequestCountTracker(host, resource)))
78 { 72 {
79 } 73 }
80 74
81 ResourceLoader::~ResourceLoader() 75 ResourceLoader::~ResourceLoader()
82 { 76 {
83 ASSERT(m_state == Terminated); 77 ASSERT(m_state == Terminated);
84 } 78 }
85 79
86 void ResourceLoader::releaseResources() 80 void ResourceLoader::releaseResources()
87 { 81 {
88 ASSERT(m_state != Terminated); 82 ASSERT(m_state != Terminated);
89 if (m_state != Uninitialized) { 83 if (m_state != Uninitialized) {
90 m_requestCountTracker.clear(); 84 m_requestCountTracker.clear();
91 m_documentLoader->cachedResourceLoader()->loadDone(m_resource); 85 m_host->didLoadResource(m_resource);
92 if (m_state == Terminated) 86 if (m_state == Terminated)
93 return; 87 return;
94 m_resource->clearLoader(); 88 m_resource->clearLoader();
95 m_documentLoader->removeResourceLoader(this); 89 m_host->willTerminateResourceLoader(this);
96 } 90 }
97 91
98 ASSERT(m_state != Terminated); 92 ASSERT(m_state != Terminated);
99 93
100 // It's possible that when we release the handle, it will be 94 // It's possible that when we release the handle, it will be
101 // deallocated and release the last reference to this object. 95 // deallocated and release the last reference to this object.
102 // We need to retain to avoid accessing the object after it 96 // We need to retain to avoid accessing the object after it
103 // has been deallocated and also to avoid reentering this method. 97 // has been deallocated and also to avoid reentering this method.
104 RefPtr<ResourceLoader> protector(this); 98 RefPtr<ResourceLoader> protector(this);
105 99
106 m_frame = 0; 100 m_host.clear();
107 m_documentLoader = 0;
108
109 m_state = Terminated; 101 m_state = Terminated;
110 102
111 if (m_handle) { 103 if (m_handle) {
112 // Clear out the ResourceHandle's client so that it doesn't try to call 104 // Clear out the ResourceHandle's client so that it doesn't try to call
113 // us back after we release it, unless it has been replaced by someone e lse. 105 // us back after we release it, unless it has been replaced by someone e lse.
114 if (m_handle->client() == this) 106 if (m_handle->client() == this)
115 m_handle->setClient(0); 107 m_handle->setClient(0);
116 m_handle = 0; 108 m_handle = 0;
117 } 109 }
118 110
(...skipping 10 matching lines...) Expand all
129 121
130 willSendRequest(0, clientRequest, ResourceResponse()); 122 willSendRequest(0, clientRequest, ResourceResponse());
131 if (clientRequest.isNull()) { 123 if (clientRequest.isNull()) {
132 cancel(); 124 cancel();
133 return false; 125 return false;
134 } 126 }
135 ASSERT(m_state != Terminated); 127 ASSERT(m_state != Terminated);
136 128
137 m_originalRequest = m_request = clientRequest; 129 m_originalRequest = m_request = clientRequest;
138 m_state = Initialized; 130 m_state = Initialized;
139 m_documentLoader->addResourceLoader(this); 131 m_host->didInitializeResourceLoader(this);
140 return true; 132 return true;
141 } 133 }
142 134
143 void ResourceLoader::start() 135 void ResourceLoader::start()
144 { 136 {
145 ASSERT(!m_handle); 137 ASSERT(!m_handle);
146 ASSERT(!m_request.isNull()); 138 ASSERT(!m_request.isNull());
147 ASSERT(m_deferredRequest.isNull()); 139 ASSERT(m_deferredRequest.isNull());
148 140
149 m_documentLoader->applicationCacheHost()->willStartLoadingResource(m_request ); 141 m_host->willStartLoadingResource(m_request);
150 142
151 if (m_defersLoading) { 143 if (m_defersLoading) {
152 m_deferredRequest = m_request; 144 m_deferredRequest = m_request;
153 return; 145 return;
154 } 146 }
155 147
156 if (m_state != Terminated) 148 if (m_state != Terminated)
157 m_handle = ResourceHandle::create(m_request, this, m_defersLoading, m_op tions.sniffContent == SniffContent, m_options.allowCredentials); 149 m_handle = ResourceHandle::create(m_request, this, m_defersLoading, m_op tions.sniffContent == SniffContent, m_options.allowCredentials);
158 } 150 }
159 151
160 void ResourceLoader::setDefersLoading(bool defers) 152 void ResourceLoader::setDefersLoading(bool defers)
161 { 153 {
162 m_defersLoading = defers; 154 m_defersLoading = defers;
163 if (m_handle) 155 if (m_handle)
164 m_handle->setDefersLoading(defers); 156 m_handle->setDefersLoading(defers);
165 if (!defers && !m_deferredRequest.isNull()) { 157 if (!defers && !m_deferredRequest.isNull()) {
166 m_request = m_deferredRequest; 158 m_request = m_deferredRequest;
167 m_deferredRequest = ResourceRequest(); 159 m_deferredRequest = ResourceRequest();
168 start(); 160 start();
169 } 161 }
170 } 162 }
171 163
172 FrameLoader* ResourceLoader::frameLoader() const
173 {
174 if (!m_frame)
175 return 0;
176 return m_frame->loader();
177 }
178
179 void ResourceLoader::didDownloadData(ResourceHandle*, int length) 164 void ResourceLoader::didDownloadData(ResourceHandle*, int length)
180 { 165 {
181 RefPtr<ResourceLoader> protect(this); 166 RefPtr<ResourceLoader> protect(this);
182 m_resource->didDownloadData(length); 167 m_resource->didDownloadData(length);
183 } 168 }
184 169
185 void ResourceLoader::didFinishLoadingOnePart(double finishTime) 170 void ResourceLoader::didFinishLoadingOnePart(double finishTime)
186 { 171 {
187 // If load has been cancelled after finishing (which could happen with a 172 // If load has been cancelled after finishing (which could happen with a
188 // JavaScript that changes the window location), do nothing. 173 // JavaScript that changes the window location), do nothing.
189 if (m_state == Terminated) 174 if (m_state == Terminated)
190 return; 175 return;
191 176
192 if (m_notifiedLoadComplete) 177 if (m_notifiedLoadComplete)
193 return; 178 return;
194 m_notifiedLoadComplete = true; 179 m_notifiedLoadComplete = true;
195 if (m_options.sendLoadCallbacks == SendCallbacks) 180 m_host->didFinishLoading(m_resource, finishTime, m_options);
196 frameLoader()->notifier()->dispatchDidFinishLoading(m_documentLoader.get (), m_resource->identifier(), finishTime);
197 } 181 }
198 182
199 void ResourceLoader::didChangePriority(ResourceLoadPriority loadPriority) 183 void ResourceLoader::didChangePriority(ResourceLoadPriority loadPriority)
200 { 184 {
201 if (handle()) { 185 if (handle()) {
202 frameLoader()->client()->dispatchDidChangeResourcePriority(m_resource->i dentifier(), loadPriority); 186 m_host->didChangeLoadingPriority(m_resource, loadPriority);
203 handle()->didChangePriority(loadPriority); 187 handle()->didChangePriority(loadPriority);
204 } 188 }
205 } 189 }
206 190
207 void ResourceLoader::cancelIfNotFinishing() 191 void ResourceLoader::cancelIfNotFinishing()
208 { 192 {
209 if (m_state != Initialized) 193 if (m_state != Initialized)
210 return; 194 return;
211 cancel(); 195 cancel();
212 } 196 }
(...skipping 22 matching lines...) Expand all
235 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string() .latin1().data()); 219 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string() .latin1().data());
236 if (m_state == Initialized) 220 if (m_state == Initialized)
237 m_state = Finishing; 221 m_state = Finishing;
238 m_resource->setResourceError(nonNullError); 222 m_resource->setResourceError(nonNullError);
239 223
240 if (m_handle) { 224 if (m_handle) {
241 m_handle->cancel(); 225 m_handle->cancel();
242 m_handle = 0; 226 m_handle = 0;
243 } 227 }
244 228
245 if (m_options.sendLoadCallbacks == SendCallbacks && !m_notifiedLoadComplete) 229 m_host->didFailLoading(m_resource, nonNullError, m_options);
246 frameLoader()->notifier()->dispatchDidFail(m_documentLoader.get(), m_res ource->identifier(), nonNullError);
247 230
248 if (m_state == Finishing) 231 if (m_state == Finishing)
249 m_resource->error(CachedResource::LoadError); 232 m_resource->error(CachedResource::LoadError);
250 if (m_state != Terminated) 233 if (m_state != Terminated)
251 releaseResources(); 234 releaseResources();
252 } 235 }
253 236
254 void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse) 237 void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse)
255 { 238 {
256 // Store the previous URL because we may modify it. 239 // Store the previous URL because we may modify it.
257 KURL previousURL = m_request.url(); 240 KURL previousURL = m_request.url();
258 RefPtr<ResourceLoader> protect(this); 241 RefPtr<ResourceLoader> protect(this);
259 242
260 ASSERT(!request.isNull()); 243 ASSERT(!request.isNull());
261 if (!redirectResponse.isNull()) { 244 if (!redirectResponse.isNull()) {
262 if (!m_documentLoader->cachedResourceLoader()->canRequest(m_resource->ty pe(), request.url(), m_options)) { 245 if (!m_host->shouldRequest(m_resource, request, m_options)) {
263 cancel(); 246 cancel();
264 return; 247 return;
265 } 248 }
266 if (m_resource->type() == CachedResource::ImageResource && m_documentLoa der->cachedResourceLoader()->shouldDeferImageLoad(request.url())) { 249
267 cancel();
268 return;
269 }
270 m_resource->willSendRequest(request, redirectResponse); 250 m_resource->willSendRequest(request, redirectResponse);
271 } 251 }
272 252
273 if (request.isNull() || m_state == Terminated) 253 if (request.isNull() || m_state == Terminated)
274 return; 254 return;
275 255
276 if (m_options.sendLoadCallbacks == SendCallbacks) 256 m_host->willSendRequest(m_resource, request, redirectResponse, m_options);
277 frameLoader()->notifier()->dispatchWillSendRequest(m_documentLoader.get( ), m_resource->identifier(), request, redirectResponse, m_options.initiatorInfo) ;
278 else
279 InspectorInstrumentation::willSendRequest(m_frame.get(), m_resource->ide ntifier(), m_documentLoader.get(), request, redirectResponse, m_options.initiato rInfo);
280
281 m_request = request; 257 m_request = request;
282 258
283 if (request.isNull()) 259 if (request.isNull())
284 cancel(); 260 cancel();
285 } 261 }
286 262
287 void ResourceLoader::didReceiveCachedMetadata(ResourceHandle*, const char* data, int length) 263 void ResourceLoader::didReceiveCachedMetadata(ResourceHandle*, const char* data, int length)
288 { 264 {
289 ASSERT(m_state == Initialized); 265 ASSERT(m_state == Initialized);
290 m_resource->setSerializedCachedMetadata(data, length); 266 m_resource->setSerializedCachedMetadata(data, length);
(...skipping 11 matching lines...) Expand all
302 ASSERT(!response.isNull()); 278 ASSERT(!response.isNull());
303 ASSERT(m_state == Initialized); 279 ASSERT(m_state == Initialized);
304 280
305 // Reference the object in this method since the additional processing can d o 281 // Reference the object in this method since the additional processing can d o
306 // anything including removing the last reference to this object. 282 // anything including removing the last reference to this object.
307 RefPtr<ResourceLoader> protect(this); 283 RefPtr<ResourceLoader> protect(this);
308 m_resource->responseReceived(response); 284 m_resource->responseReceived(response);
309 if (m_state == Terminated) 285 if (m_state == Terminated)
310 return; 286 return;
311 287
312 if (m_options.sendLoadCallbacks == SendCallbacks) 288 m_host->didReceiveResponse(m_resource, response, m_options);
313 frameLoader()->notifier()->dispatchDidReceiveResponse(m_documentLoader.g et(), m_resource->identifier(), response);
314 289
315 if (response.isMultipart()) { 290 if (response.isMultipart()) {
316 m_loadingMultipartContent = true; 291 m_loadingMultipartContent = true;
317 292
318 // We don't count multiParts in a CachedResourceLoader's request count 293 // We don't count multiParts in a CachedResourceLoader's request count
319 m_requestCountTracker.clear(); 294 m_requestCountTracker.clear();
320 if (!m_resource->isImage()) { 295 if (!m_resource->isImage()) {
321 cancel(); 296 cancel();
322 return; 297 return;
323 } 298 }
324 } else if (m_loadingMultipartContent) { 299 } else if (m_loadingMultipartContent) {
325 // Since a subresource loader does not load multipart sections progressi vely, data was delivered to the loader all at once. 300 // Since a subresource loader does not load multipart sections progressi vely, data was delivered to the loader all at once.
326 // After the first multipart section is complete, signal to delegates th at this load is "finished" 301 // After the first multipart section is complete, signal to delegates th at this load is "finished"
327 m_documentLoader->subresourceLoaderFinishedLoadingOnePart(this); 302 m_host->subresourceLoaderFinishedLoadingOnePart(this);
328 didFinishLoadingOnePart(0); 303 didFinishLoadingOnePart(0);
329 } 304 }
330 305
331 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor eHTTPStatusCodeErrors()) 306 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor eHTTPStatusCodeErrors())
332 return; 307 return;
333 m_state = Finishing; 308 m_state = Finishing;
334 m_resource->error(CachedResource::LoadError); 309 m_resource->error(CachedResource::LoadError);
335 cancel(); 310 cancel();
336 } 311 }
337 312
338 void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int lengt h, int encodedDataLength) 313 void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int lengt h, int encodedDataLength)
339 { 314 {
340 // It is possible to receive data on uninitialized resources if it had an er ror status code, and we are running a nested message 315 // It is possible to receive data on uninitialized resources if it had an er ror status code, and we are running a nested message
341 // loop. When this occurs, ignoring the data is the correct action. 316 // loop. When this occurs, ignoring the data is the correct action.
342 if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgn oreHTTPStatusCodeErrors()) 317 if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgn oreHTTPStatusCodeErrors())
343 return; 318 return;
344 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiv eResourceData(m_frame.get(), m_resource->identifier(), encodedDataLength); 319 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiv eResourceData(m_host->inspectedFrame(), m_resource->identifier(), encodedDataLen gth);
345 ASSERT(m_state == Initialized); 320 ASSERT(m_state == Initialized);
346 321
347 // Reference the object in this method since the additional processing can d o 322 // Reference the object in this method since the additional processing can d o
348 // anything including removing the last reference to this object. 323 // anything including removing the last reference to this object.
349 RefPtr<ResourceLoader> protect(this); 324 RefPtr<ResourceLoader> protect(this);
350 325
351 // FIXME: If we get a resource with more than 2B bytes, this code won't do t he right thing. 326 // FIXME: If we get a resource with more than 2B bytes, this code won't do t he right thing.
352 // However, with today's computers and networking speeds, this won't happen in practice. 327 // However, with today's computers and networking speeds, this won't happen in practice.
353 // Could be an issue with a giant local file. 328 // Could be an issue with a giant local file.
354 if (m_options.sendLoadCallbacks == SendCallbacks && m_frame) 329 m_host->didReceiveData(m_resource, data, length, encodedDataLength, m_option s);
355 frameLoader()->notifier()->dispatchDidReceiveData(m_documentLoader.get() , m_resource->identifier(), data, length, static_cast<int>(encodedDataLength));
356
357 m_resource->appendData(data, length); 330 m_resource->appendData(data, length);
358 331
359 InspectorInstrumentation::didReceiveResourceData(cookie); 332 InspectorInstrumentation::didReceiveResourceData(cookie);
360 } 333 }
361 334
362 void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime) 335 void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime)
363 { 336 {
364 if (m_state != Initialized) 337 if (m_state != Initialized)
365 return; 338 return;
366 ASSERT(m_state != Terminated); 339 ASSERT(m_state != Terminated);
(...skipping 11 matching lines...) Expand all
378 return; 351 return;
379 releaseResources(); 352 releaseResources();
380 } 353 }
381 354
382 void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error) 355 void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error)
383 { 356 {
384 ASSERT(m_state != Terminated); 357 ASSERT(m_state != Terminated);
385 LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().la tin1().data()); 358 LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().la tin1().data());
386 359
387 RefPtr<ResourceLoader> protect(this); 360 RefPtr<ResourceLoader> protect(this);
361 RefPtr<ResourceLoaderHost> protectHost(m_host);
388 CachedResourceHandle<CachedResource> protectResource(m_resource); 362 CachedResourceHandle<CachedResource> protectResource(m_resource);
389 m_state = Finishing; 363 m_state = Finishing;
390 m_resource->setResourceError(error); 364 m_resource->setResourceError(error);
391 m_resource->error(CachedResource::LoadError); 365 m_resource->error(CachedResource::LoadError);
392 366
393 if (m_state == Terminated) 367 if (m_state == Terminated)
394 return; 368 return;
395 369
396 if (!m_notifiedLoadComplete) { 370 if (!m_notifiedLoadComplete) {
397 m_notifiedLoadComplete = true; 371 m_notifiedLoadComplete = true;
398 if (m_options.sendLoadCallbacks == SendCallbacks) 372 m_host->didFailLoading(m_resource, error, m_options);
399 frameLoader()->notifier()->dispatchDidFail(m_documentLoader.get(), m _resource->identifier(), error);
400 } 373 }
401 374
402 releaseResources(); 375 releaseResources();
403 } 376 }
404 377
378 bool ResourceLoader::isLoadedBy(ResourceLoaderHost* loader) const
379 {
380 return m_host->isLoadedBy(loader);
405 } 381 }
382
383 }
OLDNEW
« no previous file with comments | « Source/core/loader/ResourceLoader.h ('k') | Source/core/loader/ResourceLoaderHost.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698