Chromium Code Reviews| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 | 557 |
| 558 if (!m_data->isLocked()) | 558 if (!m_data->isLocked()) |
| 559 return true; | 559 return true; |
| 560 | 560 |
| 561 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !isLoaded() || !isSafeToUnlock()) | 561 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !isLoaded() || !isSafeToUnlock()) |
| 562 return false; | 562 return false; |
| 563 | 563 |
| 564 if (RuntimeEnabledFeatures::doNotUnlockSharedBufferEnabled()) | 564 if (RuntimeEnabledFeatures::doNotUnlockSharedBufferEnabled()) |
| 565 return false; | 565 return false; |
| 566 | 566 |
| 567 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, unlockHistogram, new E numerationHistogram("Blink.SharedBuffer.Unlock", Manifest + 1)); | |
|
bashi
2016/07/11 08:02:27
nit: does it make sense to change the name of metr
hiroshige
2016/07/11 08:15:58
I also considered that option, but I names Blink.S
bashi
2016/07/11 08:23:22
I see. Thanks for the explanation.
Ilya Sherman
2016/07/11 19:28:33
Please document (in the header file, where the enu
hiroshige
2016/07/12 10:06:29
Done.
| |
| 568 unlockHistogram.count(getType()); | |
| 569 | |
| 567 m_data->unlock(); | 570 m_data->unlock(); |
| 568 return true; | 571 return true; |
| 569 } | 572 } |
| 570 | 573 |
| 571 void Resource::responseReceived(const ResourceResponse& response, std::unique_pt r<WebDataConsumerHandle>) | 574 void Resource::responseReceived(const ResourceResponse& response, std::unique_pt r<WebDataConsumerHandle>) |
| 572 { | 575 { |
| 573 m_responseTimestamp = currentTime(); | 576 m_responseTimestamp = currentTime(); |
| 574 if (m_preloadDiscoveryTime) { | 577 if (m_preloadDiscoveryTime) { |
| 575 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncreasin gTime() - m_preloadDiscoveryTime)); | 578 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncreasin gTime() - m_preloadDiscoveryTime)); |
| 576 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryToFirstByteHis togram, ("PreloadScanner.TTFB", 0, 10000, 50)); | 579 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryToFirstByteHis togram, ("PreloadScanner.TTFB", 0, 10000, 50)); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 979 if (!m_data) | 982 if (!m_data) |
| 980 return true; | 983 return true; |
| 981 if (m_data->isLocked()) | 984 if (m_data->isLocked()) |
| 982 return true; | 985 return true; |
| 983 | 986 |
| 984 ASSERT(!hasClientsOrObservers()); | 987 ASSERT(!hasClientsOrObservers()); |
| 985 | 988 |
| 986 // If locking fails, our buffer has been purged. There's no point | 989 // If locking fails, our buffer has been purged. There's no point |
| 987 // in leaving a purged resource in MemoryCache. | 990 // in leaving a purged resource in MemoryCache. |
| 988 if (!m_data->lock()) { | 991 if (!m_data->lock()) { |
| 992 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, failedLockHistogra m, new EnumerationHistogram("Blink.SharedBuffer.FailedLock", Manifest + 1)); | |
|
Ilya Sherman
2016/07/11 19:28:33
Using "Manifest + 1" as a boundary value is a bit
hiroshige
2016/07/12 10:06:29
Added |kLastResourceType|.
I avoid adding |Last|
| |
| 993 failedLockHistogram.count(getType()); | |
| 994 | |
| 989 m_data.clear(); | 995 m_data.clear(); |
| 990 setEncodedSize(0); | 996 setEncodedSize(0); |
| 991 memoryCache()->remove(this); | 997 memoryCache()->remove(this); |
| 992 return false; | 998 return false; |
| 993 } | 999 } |
| 1000 | |
| 1001 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, successfulLockHistogra m, new EnumerationHistogram("Blink.SharedBuffer.SuccessfulLock", Manifest + 1)); | |
| 1002 successfulLockHistogram.count(getType()); | |
| 1003 | |
| 994 return true; | 1004 return true; |
| 995 } | 1005 } |
| 996 | 1006 |
| 997 size_t Resource::calculateOverheadSize() const | 1007 size_t Resource::calculateOverheadSize() const |
| 998 { | 1008 { |
| 999 static const int kAverageClientsHashMapSize = 384; | 1009 static const int kAverageClientsHashMapSize = 384; |
| 1000 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS ize + m_resourceRequest.url().getString().length() * 2; | 1010 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS ize + m_resourceRequest.url().getString().length() * 2; |
| 1001 } | 1011 } |
| 1002 | 1012 |
| 1003 void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri orityValue) | 1013 void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri orityValue) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 case Resource::Media: | 1138 case Resource::Media: |
| 1129 return "Media"; | 1139 return "Media"; |
| 1130 case Resource::Manifest: | 1140 case Resource::Manifest: |
| 1131 return "Manifest"; | 1141 return "Manifest"; |
| 1132 } | 1142 } |
| 1133 ASSERT_NOT_REACHED(); | 1143 ASSERT_NOT_REACHED(); |
| 1134 return "Unknown"; | 1144 return "Unknown"; |
| 1135 } | 1145 } |
| 1136 | 1146 |
| 1137 } // namespace blink | 1147 } // namespace blink |
| OLD | NEW |