Title: [170499] trunk/Source/WebCore
- Revision
- 170499
- Author
- [email protected]
- Date
- 2014-06-26 15:22:40 -0700 (Thu, 26 Jun 2014)
Log Message
Skip memcmp()ing fully downloaded resources after they become mmap()able.
<https://webkit.org/b/134362>
When we receive word that a downloaded resource is now available for mmap()ing
from the file system, we don't need to compare against the buffered data,
since even if there were a mismatch, the cached version should be the canonical one.
This was added as belt-and-suspenders while the supporting mechanism was being
developed in CFNetwork, and there's no evidence of a race today. This change
turns the runtime checks into debug-only assertions.
Saves ~300ms of main thread time on PLT.
Reviewed by Geoff Garen.
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::tryReplaceEncodedData):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170498 => 170499)
--- trunk/Source/WebCore/ChangeLog 2014-06-26 22:18:57 UTC (rev 170498)
+++ trunk/Source/WebCore/ChangeLog 2014-06-26 22:22:40 UTC (rev 170499)
@@ -1,3 +1,23 @@
+2014-06-26 Andreas Kling <[email protected]>
+
+ Skip memcmp()ing fully downloaded resources after they become mmap()able.
+ <https://webkit.org/b/134362>
+
+ When we receive word that a downloaded resource is now available for mmap()ing
+ from the file system, we don't need to compare against the buffered data,
+ since even if there were a mismatch, the cached version should be the canonical one.
+
+ This was added as belt-and-suspenders while the supporting mechanism was being
+ developed in CFNetwork, and there's no evidence of a race today. This change
+ turns the runtime checks into debug-only assertions.
+
+ Saves ~300ms of main thread time on PLT.
+
+ Reviewed by Geoff Garen.
+
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::tryReplaceEncodedData):
+
2014-06-26 Jer Noble <[email protected]>
[MSE] Refactoring: Use C++11 for-loops in SourceBuffer.
Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (170498 => 170499)
--- trunk/Source/WebCore/loader/cache/CachedResource.cpp 2014-06-26 22:18:57 UTC (rev 170498)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp 2014-06-26 22:22:40 UTC (rev 170499)
@@ -900,12 +900,10 @@
if (!mayTryReplaceEncodedData())
return;
-
- // Because the disk cache is asynchronous and racey with regards to the data we might be asked to replace,
- // we need to verify that the new buffer has the same contents as our old buffer.
- if (m_data->size() != newBuffer->size() || memcmp(m_data->data(), newBuffer->data(), m_data->size()))
- return;
+ ASSERT(m_data->size() == newBuffer->size());
+ ASSERT(!memcmp(m_data->data(), newBuffer->data(), m_data->size()));
+
m_data->tryReplaceSharedBufferContents(newBuffer.get());
}
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes