| 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 30 matching lines...) Expand all Loading... |
| 41 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebScheduler.h" | 42 #include "public/platform/WebScheduler.h" |
| 43 #include "public/platform/WebSecurityOrigin.h" | 43 #include "public/platform/WebSecurityOrigin.h" |
| 44 #include "wtf/CurrentTime.h" | 44 #include "wtf/CurrentTime.h" |
| 45 #include "wtf/MathExtras.h" | 45 #include "wtf/MathExtras.h" |
| 46 #include "wtf/StdLibExtras.h" | 46 #include "wtf/StdLibExtras.h" |
| 47 #include "wtf/Vector.h" | 47 #include "wtf/Vector.h" |
| 48 #include "wtf/text/CString.h" | 48 #include "wtf/text/CString.h" |
| 49 #include "wtf/text/StringBuilder.h" | 49 #include "wtf/text/StringBuilder.h" |
| 50 #include <algorithm> | 50 #include <algorithm> |
| 51 #include <memory> | |
| 52 | 51 |
| 53 namespace blink { | 52 namespace blink { |
| 54 | 53 |
| 55 // These response headers are not copied from a revalidated response to the | 54 // These response headers are not copied from a revalidated response to the |
| 56 // cached response headers. For compatibility, this list is based on Chromium's | 55 // cached response headers. For compatibility, this list is based on Chromium's |
| 57 // net/http/http_response_headers.cc. | 56 // net/http/http_response_headers.cc. |
| 58 const char* const headersToIgnoreAfterRevalidation[] = { | 57 const char* const headersToIgnoreAfterRevalidation[] = { |
| 59 "allow", | 58 "allow", |
| 60 "connection", | 59 "connection", |
| 61 "etag", | 60 "etag", |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 public: | 229 public: |
| 231 static ResourceCallback& callbackHandler(); | 230 static ResourceCallback& callbackHandler(); |
| 232 DECLARE_TRACE(); | 231 DECLARE_TRACE(); |
| 233 void schedule(Resource*); | 232 void schedule(Resource*); |
| 234 void cancel(Resource*); | 233 void cancel(Resource*); |
| 235 bool isScheduled(Resource*) const; | 234 bool isScheduled(Resource*) const; |
| 236 private: | 235 private: |
| 237 ResourceCallback(); | 236 ResourceCallback(); |
| 238 | 237 |
| 239 void runTask(); | 238 void runTask(); |
| 240 std::unique_ptr<CancellableTaskFactory> m_callbackTaskFactory; | 239 OwnPtr<CancellableTaskFactory> m_callbackTaskFactory; |
| 241 HeapHashSet<Member<Resource>> m_resourcesWithPendingClients; | 240 HeapHashSet<Member<Resource>> m_resourcesWithPendingClients; |
| 242 }; | 241 }; |
| 243 | 242 |
| 244 Resource::ResourceCallback& Resource::ResourceCallback::callbackHandler() | 243 Resource::ResourceCallback& Resource::ResourceCallback::callbackHandler() |
| 245 { | 244 { |
| 246 // Oilpan + LSan: as the callbackHandler() singleton is used by Resource | 245 // Oilpan + LSan: as the callbackHandler() singleton is used by Resource |
| 247 // and ResourcePtr finalizers, it cannot be released upon shutdown in | 246 // and ResourcePtr finalizers, it cannot be released upon shutdown in |
| 248 // preparation for leak detection. | 247 // preparation for leak detection. |
| 249 // | 248 // |
| 250 // Keep it out of LSan's reach instead. | 249 // Keep it out of LSan's reach instead. |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !isLoaded()
|| !isSafeToUnlock()) | 560 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !isLoaded()
|| !isSafeToUnlock()) |
| 562 return false; | 561 return false; |
| 563 | 562 |
| 564 if (RuntimeEnabledFeatures::doNotUnlockSharedBufferEnabled()) | 563 if (RuntimeEnabledFeatures::doNotUnlockSharedBufferEnabled()) |
| 565 return false; | 564 return false; |
| 566 | 565 |
| 567 m_data->unlock(); | 566 m_data->unlock(); |
| 568 return true; | 567 return true; |
| 569 } | 568 } |
| 570 | 569 |
| 571 void Resource::responseReceived(const ResourceResponse& response, std::unique_pt
r<WebDataConsumerHandle>) | 570 void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<Web
DataConsumerHandle>) |
| 572 { | 571 { |
| 573 m_responseTimestamp = currentTime(); | 572 m_responseTimestamp = currentTime(); |
| 574 if (m_preloadDiscoveryTime) { | 573 if (m_preloadDiscoveryTime) { |
| 575 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncreasin
gTime() - m_preloadDiscoveryTime)); | 574 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncreasin
gTime() - m_preloadDiscoveryTime)); |
| 576 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryToFirstByteHis
togram, ("PreloadScanner.TTFB", 0, 10000, 50)); | 575 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryToFirstByteHis
togram, ("PreloadScanner.TTFB", 0, 10000, 50)); |
| 577 preloadDiscoveryToFirstByteHistogram.count(timeSinceDiscovery); | 576 preloadDiscoveryToFirstByteHistogram.count(timeSinceDiscovery); |
| 578 } | 577 } |
| 579 | 578 |
| 580 if (m_isRevalidating) { | 579 if (m_isRevalidating) { |
| 581 if (response.httpStatusCode() == 304) { | 580 if (response.httpStatusCode() == 304) { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 case Resource::Media: | 1127 case Resource::Media: |
| 1129 return "Media"; | 1128 return "Media"; |
| 1130 case Resource::Manifest: | 1129 case Resource::Manifest: |
| 1131 return "Manifest"; | 1130 return "Manifest"; |
| 1132 } | 1131 } |
| 1133 ASSERT_NOT_REACHED(); | 1132 ASSERT_NOT_REACHED(); |
| 1134 return "Unknown"; | 1133 return "Unknown"; |
| 1135 } | 1134 } |
| 1136 | 1135 |
| 1137 } // namespace blink | 1136 } // namespace blink |
| OLD | NEW |