OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * | 10 * |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 void NetworkResourcesData::addResource(const String& requestId, Resource* cached
Resource) | 255 void NetworkResourcesData::addResource(const String& requestId, Resource* cached
Resource) |
256 { | 256 { |
257 ResourceData* resourceData = resourceDataForRequestId(requestId); | 257 ResourceData* resourceData = resourceDataForRequestId(requestId); |
258 if (!resourceData) | 258 if (!resourceData) |
259 return; | 259 return; |
260 resourceData->setResource(cachedResource); | 260 resourceData->setResource(cachedResource); |
261 } | 261 } |
262 | 262 |
263 void NetworkResourcesData::addResourceSharedBuffer(const String& requestId, Pass
RefPtr<SharedBuffer> buffer, const String& textEncodingName) | |
264 { | |
265 ResourceData* resourceData = resourceDataForRequestId(requestId); | |
266 if (!resourceData) | |
267 return; | |
268 resourceData->setBuffer(buffer); | |
269 resourceData->setTextEncodingName(textEncodingName); | |
270 } | |
271 | |
272 NetworkResourcesData::ResourceData const* NetworkResourcesData::data(const Strin
g& requestId) | 263 NetworkResourcesData::ResourceData const* NetworkResourcesData::data(const Strin
g& requestId) |
273 { | 264 { |
274 return resourceDataForRequestId(requestId); | 265 return resourceDataForRequestId(requestId); |
275 } | 266 } |
276 | 267 |
277 XHRReplayData* NetworkResourcesData::xhrReplayData(const String& requestId) | 268 XHRReplayData* NetworkResourcesData::xhrReplayData(const String& requestId) |
278 { | 269 { |
279 if (m_reusedXHRReplayDataRequestIds.contains(requestId)) | 270 if (m_reusedXHRReplayDataRequestIds.contains(requestId)) |
280 return xhrReplayData(m_reusedXHRReplayDataRequestIds.get(requestId)); | 271 return xhrReplayData(m_reusedXHRReplayDataRequestIds.get(requestId)); |
281 | 272 |
(...skipping 13 matching lines...) Expand all Loading... |
295 for (it = m_reusedXHRReplayDataRequestIds.begin(); it != end; ++it) { | 286 for (it = m_reusedXHRReplayDataRequestIds.begin(); it != end; ++it) { |
296 if (it->value == requestId) | 287 if (it->value == requestId) |
297 setXHRReplayData(it->key, xhrReplayData); | 288 setXHRReplayData(it->key, xhrReplayData); |
298 } | 289 } |
299 return; | 290 return; |
300 } | 291 } |
301 | 292 |
302 resourceData->setXHRReplayData(xhrReplayData); | 293 resourceData->setXHRReplayData(xhrReplayData); |
303 } | 294 } |
304 | 295 |
305 void NetworkResourcesData::reuseXHRReplayData(const String& requestId, const Str
ing& reusedRequestId) | |
306 { | |
307 ResourceData* reusedResourceData = resourceDataForRequestId(reusedRequestId)
; | |
308 ResourceData* resourceData = resourceDataForRequestId(requestId); | |
309 if (!reusedResourceData || !resourceData) { | |
310 m_reusedXHRReplayDataRequestIds.set(requestId, reusedRequestId); | |
311 return; | |
312 } | |
313 | |
314 resourceData->setXHRReplayData(reusedResourceData->xhrReplayData()); | |
315 } | |
316 | |
317 Vector<NetworkResourcesData::ResourceData*> NetworkResourcesData::resources() | 296 Vector<NetworkResourcesData::ResourceData*> NetworkResourcesData::resources() |
318 { | 297 { |
319 Vector<ResourceData*> result; | 298 Vector<ResourceData*> result; |
320 for (ResourceDataMap::iterator it = m_requestIdToResourceDataMap.begin(); it
!= m_requestIdToResourceDataMap.end(); ++it) | 299 for (ResourceDataMap::iterator it = m_requestIdToResourceDataMap.begin(); it
!= m_requestIdToResourceDataMap.end(); ++it) |
321 result.append(it->value); | 300 result.append(it->value); |
322 return result; | 301 return result; |
323 } | 302 } |
324 | 303 |
325 Vector<String> NetworkResourcesData::removeResource(Resource* cachedResource) | 304 Vector<String> NetworkResourcesData::removeResource(Resource* cachedResource) |
326 { | 305 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 String requestId = m_requestIdsDeque.takeFirst(); | 372 String requestId = m_requestIdsDeque.takeFirst(); |
394 ResourceData* resourceData = resourceDataForRequestId(requestId); | 373 ResourceData* resourceData = resourceDataForRequestId(requestId); |
395 if (resourceData) | 374 if (resourceData) |
396 m_contentSize -= resourceData->evictContent(); | 375 m_contentSize -= resourceData->evictContent(); |
397 } | 376 } |
398 return true; | 377 return true; |
399 } | 378 } |
400 | 379 |
401 } // namespace WebCore | 380 } // namespace WebCore |
402 | 381 |
OLD | NEW |