Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: third_party/WebKit/Source/core/fetch/ScriptResource.cpp

Issue 1583263002: Experimental CompressibleString UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adopt lazy-initializing way Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/ScriptResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ScriptResource.cpp b/third_party/WebKit/Source/core/fetch/ScriptResource.cpp
index 686d4ac4b55ba0abace1d1225a85881083ec4603..c78a639af371da85d1d186bf4c93d814348cd872 100644
--- a/third_party/WebKit/Source/core/fetch/ScriptResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ScriptResource.cpp
@@ -81,7 +81,7 @@ void ScriptResource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebP
Resource::onMemoryDump(levelOfDetail, memoryDump);
const String name = getMemoryDumpName() + "/decoded_script";
auto dump = memoryDump->createMemoryAllocatorDump(name);
- dump->addScalar("size", "bytes", m_script.string().sizeInBytes());
+ dump->addScalar("size", "bytes", m_script.currentSizeInBytes());
memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName));
}
@@ -90,27 +90,27 @@ AtomicString ScriptResource::mimeType() const
return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Content_Type)).lower();
}
-const String& ScriptResource::script()
+const CompressibleString& ScriptResource::script()
{
ASSERT(!isPurgeable());
ASSERT(isLoaded());
- if (!m_script && m_data) {
+ if (m_script.isNull() && m_data) {
String script = decodedText();
m_data.clear();
// We lie a it here and claim that script counts as encoded data (even though it's really decoded data).
// That's because the MemoryCache thinks that it can clear out decoded data by calling destroyDecodedData(),
// but we can't destroy script in destroyDecodedData because that's our only copy of the data!
setEncodedSize(script.sizeInBytes());
- m_script = AtomicString(script);
+ m_script = CompressibleString(script.impl());
}
- return m_script.string();
+ return m_script;
}
void ScriptResource::destroyDecodedDataForFailedRevalidation()
{
- m_script = AtomicString();
+ m_script = CompressibleString();
}
bool ScriptResource::mimeTypeAllowedByNosniff() const
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ScriptResource.h ('k') | third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698