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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 , m_options(options) | 149 , m_options(options) |
150 , m_responseTimestamp(currentTime()) | 150 , m_responseTimestamp(currentTime()) |
151 , m_cancelTimer(this, &Resource::cancelTimerFired) | 151 , m_cancelTimer(this, &Resource::cancelTimerFired) |
152 #if !ENABLE(OILPAN) | 152 #if !ENABLE(OILPAN) |
153 , m_weakPtrFactory(this) | 153 , m_weakPtrFactory(this) |
154 #endif | 154 #endif |
155 , m_loadFinishTime(0) | 155 , m_loadFinishTime(0) |
156 , m_identifier(0) | 156 , m_identifier(0) |
157 , m_encodedSize(0) | 157 , m_encodedSize(0) |
158 , m_decodedSize(0) | 158 , m_decodedSize(0) |
159 , m_overheadSize(calculateOverheadSize()) | |
159 , m_preloadCount(0) | 160 , m_preloadCount(0) |
160 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()) | 161 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()) |
161 , m_preloadResult(PreloadNotReferenced) | 162 , m_preloadResult(PreloadNotReferenced) |
162 , m_type(type) | 163 , m_type(type) |
163 , m_status(NotStarted) | 164 , m_status(NotStarted) |
164 , m_needsSynchronousCacheHit(false) | 165 , m_needsSynchronousCacheHit(false) |
165 , m_linkPreload(false) | 166 , m_linkPreload(false) |
166 { | 167 { |
167 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car eless updates of the enum. | 168 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car eless updates of the enum. |
168 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter); | 169 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter); |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 // in leaving a purged resource in MemoryCache. | 892 // in leaving a purged resource in MemoryCache. |
892 if (!m_data->lock()) { | 893 if (!m_data->lock()) { |
893 m_data.clear(); | 894 m_data.clear(); |
894 setEncodedSize(0); | 895 setEncodedSize(0); |
895 memoryCache()->remove(this); | 896 memoryCache()->remove(this); |
896 return false; | 897 return false; |
897 } | 898 } |
898 return true; | 899 return true; |
899 } | 900 } |
900 | 901 |
901 size_t Resource::overheadSize() const | 902 size_t Resource::calculateOverheadSize() const |
902 { | 903 { |
903 static const int kAverageClientsHashMapSize = 384; | 904 static const int kAverageClientsHashMapSize = 384; |
904 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS ize + m_resourceRequest.url().getString().length() * 2; | 905 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS ize + m_resourceRequest.url().getString().length() * 2; |
Nate Chapin
2016/03/29 18:17:34
This is the only callsite of m_response.memoryUsag
hiroshige
2016/03/29 19:19:00
I'll do it in a separate CL to keep this crash-fix
| |
905 } | 906 } |
906 | 907 |
907 void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri orityValue) | 908 void Resource::didChangePriority(ResourceLoadPriority loadPriority, int intraPri orityValue) |
908 { | 909 { |
909 m_resourceRequest.setPriority(loadPriority, intraPriorityValue); | 910 m_resourceRequest.setPriority(loadPriority, intraPriorityValue); |
910 if (m_loader) | 911 if (m_loader) |
911 m_loader->didChangePriority(loadPriority, intraPriorityValue); | 912 m_loader->didChangePriority(loadPriority, intraPriorityValue); |
912 } | 913 } |
913 | 914 |
914 Resource::ResourceCallback* Resource::ResourceCallback::callbackHandler() | 915 Resource::ResourceCallback* Resource::ResourceCallback::callbackHandler() |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1086 case Resource::Media: | 1087 case Resource::Media: |
1087 return "Media"; | 1088 return "Media"; |
1088 case Resource::Manifest: | 1089 case Resource::Manifest: |
1089 return "Manifest"; | 1090 return "Manifest"; |
1090 } | 1091 } |
1091 ASSERT_NOT_REACHED(); | 1092 ASSERT_NOT_REACHED(); |
1092 return "Unknown"; | 1093 return "Unknown"; |
1093 } | 1094 } |
1094 | 1095 |
1095 } // namespace blink | 1096 } // namespace blink |
OLD | NEW |