| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "core/fetch/Resource.h" | 24 #include "core/fetch/Resource.h" |
| 25 | 25 |
| 26 #include "core/fetch/CachedMetadata.h" | 26 #include "core/fetch/CachedMetadata.h" |
| 27 #include "core/fetch/CrossOriginAccessControl.h" | 27 #include "core/fetch/CrossOriginAccessControl.h" |
| 28 #include "core/fetch/FetchInitiatorTypeNames.h" | 28 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 29 #include "core/fetch/MemoryCache.h" | 29 #include "core/fetch/MemoryCache.h" |
| 30 #include "core/fetch/ResourceClient.h" | 30 #include "core/fetch/ResourceClient.h" |
| 31 #include "core/fetch/ResourceClientOrObserverWalker.h" | 31 #include "core/fetch/ResourceClientOrObserverWalker.h" |
| 32 #include "core/fetch/ResourceFetcher.h" | |
| 33 #include "core/fetch/ResourceLoader.h" | 32 #include "core/fetch/ResourceLoader.h" |
| 34 #include "core/inspector/InspectorInstrumentation.h" | 33 #include "core/inspector/InspectorInstrumentation.h" |
| 35 #include "core/inspector/InstanceCounters.h" | 34 #include "core/inspector/InstanceCounters.h" |
| 36 #include "platform/Logging.h" | 35 #include "platform/Logging.h" |
| 37 #include "platform/SharedBuffer.h" | 36 #include "platform/SharedBuffer.h" |
| 38 #include "platform/TraceEvent.h" | 37 #include "platform/TraceEvent.h" |
| 39 #include "platform/network/HTTPParsers.h" | 38 #include "platform/network/HTTPParsers.h" |
| 40 #include "platform/weborigin/KURL.h" | 39 #include "platform/weborigin/KURL.h" |
| 41 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebProcessMemoryDump.h" | 41 #include "public/platform/WebProcessMemoryDump.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 InspectorInstrumentation::willDestroyResource(this); | 329 InspectorInstrumentation::willDestroyResource(this); |
| 331 willDestroyResourceInternal(); | 330 willDestroyResourceInternal(); |
| 332 } | 331 } |
| 333 | 332 |
| 334 DEFINE_TRACE(Resource) | 333 DEFINE_TRACE(Resource) |
| 335 { | 334 { |
| 336 visitor->trace(m_loader); | 335 visitor->trace(m_loader); |
| 337 visitor->trace(m_cacheHandler); | 336 visitor->trace(m_cacheHandler); |
| 338 } | 337 } |
| 339 | 338 |
| 340 void Resource::load(ResourceFetcher* fetcher) | 339 void Resource::setLoader(ResourceLoader* loader) |
| 341 { | 340 { |
| 342 // TOOD(japhet): Temporary, out of place hack to stop a top crasher. | |
| 343 // Make this more organic. | |
| 344 if (!fetcher->loadingTaskRunner()) | |
| 345 return; | |
| 346 | |
| 347 RELEASE_ASSERT(!m_loader); | 341 RELEASE_ASSERT(!m_loader); |
| 348 ASSERT(stillNeedsLoad()); | 342 ASSERT(stillNeedsLoad()); |
| 343 m_loader = loader; |
| 349 m_status = Pending; | 344 m_status = Pending; |
| 350 | |
| 351 ResourceRequest& request(m_revalidatingRequest.isNull() ? m_resourceRequest
: m_revalidatingRequest); | |
| 352 KURL url = request.url(); | |
| 353 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | |
| 354 | |
| 355 m_fetcherSecurityOrigin = fetcher->context().getSecurityOrigin(); | |
| 356 m_loader = ResourceLoader::create(fetcher, this); | |
| 357 m_loader->start(request); | |
| 358 // If the request reference is null (i.e., a synchronous revalidation will | |
| 359 // null the request), don't make the request non-null by setting the url. | |
| 360 if (!request.isNull()) | |
| 361 request.setURL(url); | |
| 362 } | 345 } |
| 363 | 346 |
| 364 void Resource::checkNotify() | 347 void Resource::checkNotify() |
| 365 { | 348 { |
| 366 if (isLoading()) | 349 if (isLoading()) |
| 367 return; | 350 return; |
| 368 | 351 |
| 369 ResourceClientWalker<ResourceClient> w(m_clients); | 352 ResourceClientWalker<ResourceClient> w(m_clients); |
| 370 while (ResourceClient* c = w.next()) | 353 while (ResourceClient* c = w.next()) |
| 371 c->notifyFinished(this); | 354 c->notifyFinished(this); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 } | 536 } |
| 554 | 537 |
| 555 void Resource::setRevalidatingRequest(const ResourceRequest& request) | 538 void Resource::setRevalidatingRequest(const ResourceRequest& request) |
| 556 { | 539 { |
| 557 m_revalidatingRequest = request; | 540 m_revalidatingRequest = request; |
| 558 m_status = NotStarted; | 541 m_status = NotStarted; |
| 559 } | 542 } |
| 560 | 543 |
| 561 void Resource::willFollowRedirect(ResourceRequest& newRequest, const ResourceRes
ponse& redirectResponse) | 544 void Resource::willFollowRedirect(ResourceRequest& newRequest, const ResourceRes
ponse& redirectResponse) |
| 562 { | 545 { |
| 563 newRequest.setAllowStoredCredentials(m_options.allowCredentials == AllowStor
edCredentials); | |
| 564 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); | 546 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); |
| 565 } | 547 } |
| 566 | 548 |
| 567 void Resource::setResponse(const ResourceResponse& response) | 549 void Resource::setResponse(const ResourceResponse& response) |
| 568 { | 550 { |
| 569 m_response = response; | 551 m_response = response; |
| 570 if (m_response.wasFetchedViaServiceWorker()) | 552 if (m_response.wasFetchedViaServiceWorker()) |
| 571 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create(this
, m_fetcherSecurityOrigin.get()); | 553 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create(this
, m_fetcherSecurityOrigin.get()); |
| 572 } | 554 } |
| 573 | 555 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 case Resource::Media: | 1112 case Resource::Media: |
| 1131 return "Media"; | 1113 return "Media"; |
| 1132 case Resource::Manifest: | 1114 case Resource::Manifest: |
| 1133 return "Manifest"; | 1115 return "Manifest"; |
| 1134 } | 1116 } |
| 1135 ASSERT_NOT_REACHED(); | 1117 ASSERT_NOT_REACHED(); |
| 1136 return "Unknown"; | 1118 return "Unknown"; |
| 1137 } | 1119 } |
| 1138 | 1120 |
| 1139 } // namespace blink | 1121 } // namespace blink |
| OLD | NEW |