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

Unified Diff: third_party/WebKit/Source/web/WebFrameSerializer.cpp

Issue 2364923004: Add UMA histograms to MHTML save operations. (Closed)
Patch Set: Address code review comments. Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameSerializer.cpp ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebFrameSerializer.cpp
diff --git a/third_party/WebKit/Source/web/WebFrameSerializer.cpp b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
index fb8ffc3fb4aa4e50b2d2cbfce43d8a3aafb33341..15923ed2b070310f3f3808b2174505bed1b4a916 100644
--- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp
+++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
@@ -43,6 +43,7 @@
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLTableElement.h"
#include "core/loader/DocumentLoader.h"
+#include "platform/Histogram.h"
#include "platform/SerializedResource.h"
#include "platform/SharedBuffer.h"
#include "platform/TraceEvent.h"
@@ -217,11 +218,14 @@ WebData WebFrameSerializer::generateMHTMLParts(
: MHTMLArchive::EncodingPolicy::UseDefaultEncoding;
// Serialize.
- Vector<SerializedResource> resources;
TRACE_EVENT_BEGIN0("page-serialization", "WebFrameSerializer::generateMHTMLParts serializing");
- MHTMLFrameSerializerDelegate coreDelegate(*webDelegate);
- FrameSerializer serializer(resources, coreDelegate);
- serializer.serializeFrame(*frame);
+ Vector<SerializedResource> resources;
+ {
+ SCOPED_BLINK_UMA_HISTOGRAM_TIMER("PageSerialization.MhtmlGeneration.SerializationTime.SingleFrame");
+ MHTMLFrameSerializerDelegate coreDelegate(*webDelegate);
+ FrameSerializer serializer(resources, coreDelegate);
+ serializer.serializeFrame(*frame);
+ }
TRACE_EVENT_END1("page-serialization", "WebFrameSerializer::generateMHTMLParts serializing",
"resource count", static_cast<unsigned long long>(resources.size()));
@@ -230,17 +234,20 @@ WebData WebFrameSerializer::generateMHTMLParts(
// Encode serializer's output as MHTML.
RefPtr<SharedBuffer> output = SharedBuffer::create();
- bool isFirstResource = true;
- for (const SerializedResource& resource : resources) {
- TRACE_EVENT0("page-serialization", "WebFrameSerializer::generateMHTMLParts encoding");
- // Frame is the 1st resource (see FrameSerializer::serializeFrame doc
- // comment). Frames get a Content-ID header.
- String contentID = isFirstResource ? frameContentID : String();
-
- MHTMLArchive::generateMHTMLPart(
- boundary, contentID, encodingPolicy, resource, *output);
-
- isFirstResource = false;
+ {
+ SCOPED_BLINK_UMA_HISTOGRAM_TIMER("PageSerialization.MhtmlGeneration.EncodingTime.SingleFrame");
+ bool isFirstResource = true;
+ for (const SerializedResource& resource : resources) {
+ TRACE_EVENT0("page-serialization", "WebFrameSerializer::generateMHTMLParts encoding");
+ // Frame is the 1st resource (see FrameSerializer::serializeFrame doc
+ // comment). Frames get a Content-ID header.
+ String contentID = isFirstResource ? frameContentID : String();
+
+ MHTMLArchive::generateMHTMLPart(
+ boundary, contentID, encodingPolicy, resource, *output);
+
+ isFirstResource = false;
+ }
}
return output.release();
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameSerializer.cpp ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698