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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 ASSERT_NOT_REACHED(); | 138 ASSERT_NOT_REACHED(); |
139 return ResourceLoadPriorityUnresolved; | 139 return ResourceLoadPriorityUnresolved; |
140 } | 140 } |
141 | 141 |
142 static Resource* resourceFromDataURIRequest(const ResourceRequest& request, cons
t ResourceLoaderOptions& resourceOptions, const String& cacheIdentifier) | 142 static Resource* resourceFromDataURIRequest(const ResourceRequest& request, cons
t ResourceLoaderOptions& resourceOptions, const String& cacheIdentifier) |
143 { | 143 { |
144 const KURL& url = request.url(); | 144 const KURL& url = request.url(); |
145 ASSERT(url.protocolIsData()); | 145 ASSERT(url.protocolIsData()); |
146 | 146 |
147 blink::WebString mimetype; | 147 WebString mimetype; |
148 blink::WebString charset; | 148 WebString charset; |
149 RefPtr<SharedBuffer> data = PassRefPtr<SharedBuffer>(blink::Platform::curren
t()->parseDataURL(url, mimetype, charset)); | 149 RefPtr<SharedBuffer> data = PassRefPtr<SharedBuffer>(Platform::current()->pa
rseDataURL(url, mimetype, charset)); |
150 if (!data) | 150 if (!data) |
151 return nullptr; | 151 return nullptr; |
152 ResourceResponse response(url, mimetype, data->size(), charset, String()); | 152 ResourceResponse response(url, mimetype, data->size(), charset, String()); |
153 | 153 |
154 Resource* resource = createResource(Resource::Image, request, charset); | 154 Resource* resource = createResource(Resource::Image, request, charset); |
155 resource->setOptions(resourceOptions); | 155 resource->setOptions(resourceOptions); |
156 // FIXME: We should provide a body stream here. | 156 // FIXME: We should provide a body stream here. |
157 resource->responseReceived(response, nullptr); | 157 resource->responseReceived(response, nullptr); |
158 if (data->size()) | 158 if (data->size()) |
159 resource->setResourceBuffer(data); | 159 resource->setResourceBuffer(data); |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 | 1258 |
1259 ResourceFetcher::DeadResourceStatsRecorder::DeadResourceStatsRecorder() | 1259 ResourceFetcher::DeadResourceStatsRecorder::DeadResourceStatsRecorder() |
1260 : m_useCount(0) | 1260 : m_useCount(0) |
1261 , m_revalidateCount(0) | 1261 , m_revalidateCount(0) |
1262 , m_loadCount(0) | 1262 , m_loadCount(0) |
1263 { | 1263 { |
1264 } | 1264 } |
1265 | 1265 |
1266 ResourceFetcher::DeadResourceStatsRecorder::~DeadResourceStatsRecorder() | 1266 ResourceFetcher::DeadResourceStatsRecorder::~DeadResourceStatsRecorder() |
1267 { | 1267 { |
1268 blink::Platform::current()->histogramCustomCounts( | 1268 Platform::current()->histogramCustomCounts( |
1269 "WebCore.ResourceFetcher.HitCount", m_useCount, 0, 1000, 50); | 1269 "WebCore.ResourceFetcher.HitCount", m_useCount, 0, 1000, 50); |
1270 blink::Platform::current()->histogramCustomCounts( | 1270 Platform::current()->histogramCustomCounts( |
1271 "WebCore.ResourceFetcher.RevalidateCount", m_revalidateCount, 0, 1000, 5
0); | 1271 "WebCore.ResourceFetcher.RevalidateCount", m_revalidateCount, 0, 1000, 5
0); |
1272 blink::Platform::current()->histogramCustomCounts( | 1272 Platform::current()->histogramCustomCounts( |
1273 "WebCore.ResourceFetcher.LoadCount", m_loadCount, 0, 1000, 50); | 1273 "WebCore.ResourceFetcher.LoadCount", m_loadCount, 0, 1000, 50); |
1274 } | 1274 } |
1275 | 1275 |
1276 void ResourceFetcher::DeadResourceStatsRecorder::update(RevalidationPolicy polic
y) | 1276 void ResourceFetcher::DeadResourceStatsRecorder::update(RevalidationPolicy polic
y) |
1277 { | 1277 { |
1278 switch (policy) { | 1278 switch (policy) { |
1279 case Reload: | 1279 case Reload: |
1280 case Load: | 1280 case Load: |
1281 ++m_loadCount; | 1281 ++m_loadCount; |
1282 return; | 1282 return; |
(...skipping 15 matching lines...) Expand all Loading... |
1298 ResourceLoaderHost::trace(visitor); | 1298 ResourceLoaderHost::trace(visitor); |
1299 } | 1299 } |
1300 | 1300 |
1301 ResourceFetcher* ResourceFetcher::toResourceFetcher(ResourceLoaderHost* host) | 1301 ResourceFetcher* ResourceFetcher::toResourceFetcher(ResourceLoaderHost* host) |
1302 { | 1302 { |
1303 ASSERT(host->objectType() == ResourceLoaderHost::ResourceFetcherType); | 1303 ASSERT(host->objectType() == ResourceLoaderHost::ResourceFetcherType); |
1304 return static_cast<ResourceFetcher*>(host); | 1304 return static_cast<ResourceFetcher*>(host); |
1305 } | 1305 } |
1306 | 1306 |
1307 } | 1307 } |
OLD | NEW |