| 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/InstanceCounters.h" | 33 #include "core/inspector/InstanceCounters.h" |
| 35 #include "platform/Histogram.h" | 34 #include "platform/Histogram.h" |
| 36 #include "platform/Logging.h" | 35 #include "platform/Logging.h" |
| 37 #include "platform/RuntimeEnabledFeatures.h" | 36 #include "platform/RuntimeEnabledFeatures.h" |
| 38 #include "platform/SharedBuffer.h" | 37 #include "platform/SharedBuffer.h" |
| 39 #include "platform/TraceEvent.h" | 38 #include "platform/TraceEvent.h" |
| 40 #include "platform/network/HTTPParsers.h" | 39 #include "platform/network/HTTPParsers.h" |
| 41 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 42 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 { | 324 { |
| 326 InstanceCounters::decrementCounter(InstanceCounters::ResourceCounter); | 325 InstanceCounters::decrementCounter(InstanceCounters::ResourceCounter); |
| 327 } | 326 } |
| 328 | 327 |
| 329 DEFINE_TRACE(Resource) | 328 DEFINE_TRACE(Resource) |
| 330 { | 329 { |
| 331 visitor->trace(m_loader); | 330 visitor->trace(m_loader); |
| 332 visitor->trace(m_cacheHandler); | 331 visitor->trace(m_cacheHandler); |
| 333 } | 332 } |
| 334 | 333 |
| 335 void Resource::load(ResourceFetcher* fetcher) | 334 void Resource::setLoader(ResourceLoader* loader) |
| 336 { | 335 { |
| 337 // TOOD(japhet): Temporary, out of place hack to stop a top crasher. | |
| 338 // Make this more organic. | |
| 339 if (!fetcher->loadingTaskRunner()) | |
| 340 return; | |
| 341 | |
| 342 RELEASE_ASSERT(!m_loader); | 336 RELEASE_ASSERT(!m_loader); |
| 343 ASSERT(stillNeedsLoad()); | 337 ASSERT(stillNeedsLoad()); |
| 338 m_loader = loader; |
| 344 m_status = Pending; | 339 m_status = Pending; |
| 345 | |
| 346 KURL url = m_resourceRequest.url(); | |
| 347 m_resourceRequest.setAllowStoredCredentials(m_options.allowCredentials == Al
lowStoredCredentials); | |
| 348 | |
| 349 m_fetcherSecurityOrigin = fetcher->context().getSecurityOrigin(); | |
| 350 m_loader = ResourceLoader::create(fetcher, this); | |
| 351 m_loader->start(m_resourceRequest); | |
| 352 m_resourceRequest.setURL(url); | |
| 353 } | 340 } |
| 354 | 341 |
| 355 void Resource::checkNotify() | 342 void Resource::checkNotify() |
| 356 { | 343 { |
| 357 if (isLoading()) | 344 if (isLoading()) |
| 358 return; | 345 return; |
| 359 | 346 |
| 360 ResourceClientWalker<ResourceClient> w(m_clients); | 347 ResourceClientWalker<ResourceClient> w(m_clients); |
| 361 while (ResourceClient* c = w.next()) | 348 while (ResourceClient* c = w.next()) |
| 362 c->notifyFinished(this); | 349 c->notifyFinished(this); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 DCHECK(!request.isNull()); | 532 DCHECK(!request.isNull()); |
| 546 m_isRevalidating = true; | 533 m_isRevalidating = true; |
| 547 m_resourceRequest = request; | 534 m_resourceRequest = request; |
| 548 m_status = NotStarted; | 535 m_status = NotStarted; |
| 549 } | 536 } |
| 550 | 537 |
| 551 void Resource::willFollowRedirect(ResourceRequest& newRequest, const ResourceRes
ponse& redirectResponse) | 538 void Resource::willFollowRedirect(ResourceRequest& newRequest, const ResourceRes
ponse& redirectResponse) |
| 552 { | 539 { |
| 553 if (m_isRevalidating) | 540 if (m_isRevalidating) |
| 554 revalidationFailed(); | 541 revalidationFailed(); |
| 555 | |
| 556 newRequest.setAllowStoredCredentials(m_options.allowCredentials == AllowStor
edCredentials); | |
| 557 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); | 542 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); |
| 558 } | 543 } |
| 559 | 544 |
| 560 void Resource::setResponse(const ResourceResponse& response) | 545 void Resource::setResponse(const ResourceResponse& response) |
| 561 { | 546 { |
| 562 m_response = response; | 547 m_response = response; |
| 563 if (m_response.wasFetchedViaServiceWorker()) | 548 if (m_response.wasFetchedViaServiceWorker()) |
| 564 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create(this
, m_fetcherSecurityOrigin.get()); | 549 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create(this
, m_fetcherSecurityOrigin.get()); |
| 565 } | 550 } |
| 566 | 551 |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 case Resource::Media: | 1127 case Resource::Media: |
| 1143 return "Media"; | 1128 return "Media"; |
| 1144 case Resource::Manifest: | 1129 case Resource::Manifest: |
| 1145 return "Manifest"; | 1130 return "Manifest"; |
| 1146 } | 1131 } |
| 1147 ASSERT_NOT_REACHED(); | 1132 ASSERT_NOT_REACHED(); |
| 1148 return "Unknown"; | 1133 return "Unknown"; |
| 1149 } | 1134 } |
| 1150 | 1135 |
| 1151 } // namespace blink | 1136 } // namespace blink |
| OLD | NEW |