| 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 | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 7 rights reserved. | 7 rights reserved. |
| 8 | 8 |
| 9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
| 10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 Resource::ResourceCallback& Resource::ResourceCallback::callbackHandler() { | 260 Resource::ResourceCallback& Resource::ResourceCallback::callbackHandler() { |
| 261 DEFINE_STATIC_LOCAL(ResourceCallback, callbackHandler, ()); | 261 DEFINE_STATIC_LOCAL(ResourceCallback, callbackHandler, ()); |
| 262 return callbackHandler; | 262 return callbackHandler; |
| 263 } | 263 } |
| 264 | 264 |
| 265 Resource::ResourceCallback::ResourceCallback() | 265 Resource::ResourceCallback::ResourceCallback() |
| 266 : m_callbackTaskFactory( | 266 : m_callbackTaskFactory( |
| 267 CancellableTaskFactory::create(this, &ResourceCallback::runTask)) {} | 267 CancellableTaskFactory::create(this, &ResourceCallback::runTask)) {} |
| 268 | 268 |
| 269 void Resource::ResourceCallback::schedule(Resource* resource) { | 269 void Resource::ResourceCallback::schedule(Resource* resource) { |
| 270 if (!m_callbackTaskFactory->isPending()) | 270 if (!m_callbackTaskFactory->isPending()) { |
| 271 Platform::current() | 271 Platform::current() |
| 272 ->currentThread() | 272 ->currentThread() |
| 273 ->scheduler() | 273 ->scheduler() |
| 274 ->loadingTaskRunner() | 274 ->loadingTaskRunner() |
| 275 ->postTask(BLINK_FROM_HERE, m_callbackTaskFactory->cancelAndCreate()); | 275 ->postTask(BLINK_FROM_HERE, m_callbackTaskFactory->cancelAndCreate()); |
| 276 } |
| 276 m_resourcesWithPendingClients.add(resource); | 277 m_resourcesWithPendingClients.add(resource); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void Resource::ResourceCallback::cancel(Resource* resource) { | 280 void Resource::ResourceCallback::cancel(Resource* resource) { |
| 280 m_resourcesWithPendingClients.remove(resource); | 281 m_resourcesWithPendingClients.remove(resource); |
| 281 if (m_callbackTaskFactory->isPending() && | 282 if (m_callbackTaskFactory->isPending() && |
| 282 m_resourcesWithPendingClients.isEmpty()) | 283 m_resourcesWithPendingClients.isEmpty()) |
| 283 m_callbackTaskFactory->cancel(); | 284 m_callbackTaskFactory->cancel(); |
| 284 } | 285 } |
| 285 | 286 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 bool Resource::willFollowRedirect(const ResourceRequest& newRequest, | 573 bool Resource::willFollowRedirect(const ResourceRequest& newRequest, |
| 573 const ResourceResponse& redirectResponse) { | 574 const ResourceResponse& redirectResponse) { |
| 574 if (m_isRevalidating) | 575 if (m_isRevalidating) |
| 575 revalidationFailed(); | 576 revalidationFailed(); |
| 576 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); | 577 m_redirectChain.append(RedirectPair(newRequest, redirectResponse)); |
| 577 return true; | 578 return true; |
| 578 } | 579 } |
| 579 | 580 |
| 580 void Resource::setResponse(const ResourceResponse& response) { | 581 void Resource::setResponse(const ResourceResponse& response) { |
| 581 m_response = response; | 582 m_response = response; |
| 582 if (m_response.wasFetchedViaServiceWorker()) | 583 if (m_response.wasFetchedViaServiceWorker()) { |
| 583 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create( | 584 m_cacheHandler = ServiceWorkerResponseCachedMetadataHandler::create( |
| 584 this, m_fetcherSecurityOrigin.get()); | 585 this, m_fetcherSecurityOrigin.get()); |
| 586 } |
| 585 } | 587 } |
| 586 | 588 |
| 587 void Resource::responseReceived(const ResourceResponse& response, | 589 void Resource::responseReceived(const ResourceResponse& response, |
| 588 std::unique_ptr<WebDataConsumerHandle>) { | 590 std::unique_ptr<WebDataConsumerHandle>) { |
| 589 m_responseTimestamp = currentTime(); | 591 m_responseTimestamp = currentTime(); |
| 590 if (m_preloadDiscoveryTime) { | 592 if (m_preloadDiscoveryTime) { |
| 591 int timeSinceDiscovery = static_cast<int>( | 593 int timeSinceDiscovery = static_cast<int>( |
| 592 1000 * (monotonicallyIncreasingTime() - m_preloadDiscoveryTime)); | 594 1000 * (monotonicallyIncreasingTime() - m_preloadDiscoveryTime)); |
| 593 DEFINE_STATIC_LOCAL(CustomCountHistogram, | 595 DEFINE_STATIC_LOCAL(CustomCountHistogram, |
| 594 preloadDiscoveryToFirstByteHistogram, | 596 preloadDiscoveryToFirstByteHistogram, |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 case Resource::TextTrack: | 1098 case Resource::TextTrack: |
| 1097 case Resource::Media: | 1099 case Resource::Media: |
| 1098 case Resource::Manifest: | 1100 case Resource::Manifest: |
| 1099 return false; | 1101 return false; |
| 1100 } | 1102 } |
| 1101 NOTREACHED(); | 1103 NOTREACHED(); |
| 1102 return false; | 1104 return false; |
| 1103 } | 1105 } |
| 1104 | 1106 |
| 1105 } // namespace blink | 1107 } // namespace blink |
| OLD | NEW |