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