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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 { | 406 { |
407 // We only expect to receive cached metadata from the platform once. | 407 // We only expect to receive cached metadata from the platform once. |
408 // If this triggers, it indicates an efficiency problem which is most | 408 // If this triggers, it indicates an efficiency problem which is most |
409 // likely unexpected in code designed to improve performance. | 409 // likely unexpected in code designed to improve performance. |
410 ASSERT(!m_cachedMetadata); | 410 ASSERT(!m_cachedMetadata); |
411 ASSERT(!m_resourceToRevalidate); | 411 ASSERT(!m_resourceToRevalidate); |
412 | 412 |
413 m_cachedMetadata = CachedMetadata::deserialize(data, size); | 413 m_cachedMetadata = CachedMetadata::deserialize(data, size); |
414 } | 414 } |
415 | 415 |
416 void Resource::setCachedMetadata(unsigned dataTypeID, const char* data, size_t s
ize) | 416 void Resource::setCachedMetadata(unsigned dataTypeID, const char* data, size_t s
ize, MetadataCacheType cacheType) |
417 { | 417 { |
418 // Currently, only one type of cached metadata per resource is supported. | 418 // Currently, only one type of cached metadata per resource is supported. |
419 // If the need arises for multiple types of metadata per resource this could | 419 // If the need arises for multiple types of metadata per resource this could |
420 // be enhanced to store types of metadata in a map. | 420 // be enhanced to store types of metadata in a map. |
421 ASSERT(!m_cachedMetadata); | 421 ASSERT(!m_cachedMetadata); |
422 | 422 |
423 m_cachedMetadata = CachedMetadata::create(dataTypeID, data, size); | 423 m_cachedMetadata = CachedMetadata::create(dataTypeID, data, size); |
424 const Vector<char>& serializedData = m_cachedMetadata->serialize(); | 424 |
425 blink::Platform::current()->cacheMetadata(m_response.url(), m_response.respo
nseTime(), serializedData.data(), serializedData.size()); | 425 if (cacheType == SendToPlatform) { |
| 426 const Vector<char>& serializedData = m_cachedMetadata->serialize(); |
| 427 blink::Platform::current()->cacheMetadata(m_response.url(), m_response.r
esponseTime(), serializedData.data(), serializedData.size()); |
| 428 } |
426 } | 429 } |
427 | 430 |
428 void Resource::clearCachedMetadata() | 431 void Resource::clearCachedMetadata() |
429 { | 432 { |
430 m_cachedMetadata.clear(); | 433 m_cachedMetadata.clear(); |
431 } | 434 } |
432 | 435 |
433 bool Resource::canDelete() const | 436 bool Resource::canDelete() const |
434 { | 437 { |
435 return !hasClients() && !m_loader && !m_preloadCount && hasRightHandleCountA
partFromCache(0) | 438 return !hasClients() && !m_loader && !m_preloadCount && hasRightHandleCountA
partFromCache(0) |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 return "ImportResource"; | 1017 return "ImportResource"; |
1015 case Resource::Media: | 1018 case Resource::Media: |
1016 return "Media"; | 1019 return "Media"; |
1017 } | 1020 } |
1018 ASSERT_NOT_REACHED(); | 1021 ASSERT_NOT_REACHED(); |
1019 return "Unknown"; | 1022 return "Unknown"; |
1020 } | 1023 } |
1021 #endif // !LOG_DISABLED | 1024 #endif // !LOG_DISABLED |
1022 | 1025 |
1023 } | 1026 } |
OLD | NEW |