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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2344153003: Adds tracing to MHTML generation call chain. (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
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 48f0183ed0ba72e1ae632028c1a41d224b87eec7..090c59382f5197682a32e55d09630500ab8f04da 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -30,7 +30,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
-#include "base/trace_event/trace_event_argument.h"
+#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "cc/base/switches.h"
#include "content/child/appcache/appcache_dispatcher.h"
@@ -5176,6 +5176,7 @@ void RenderFrameImpl::OnGetSerializedHtmlWithLocalLinks(
void RenderFrameImpl::OnSerializeAsMHTML(
const FrameMsg_SerializeAsMHTML_Params& params) {
+ TRACE_EVENT0("page-serialization", "RenderFrameImpl::OnSerializeAsMHTML");
// Unpack IPC payload.
base::File file = IPC::PlatformFileForTransitToFile(params.destination_file);
const WebString mhtml_boundary =
@@ -5191,9 +5192,11 @@ void RenderFrameImpl::OnSerializeAsMHTML(
// Generate MHTML header if needed.
if (IsMainFrame()) {
+ TRACE_EVENT0("page-serialization",
+ "RenderFrameImpl::OnSerializeAsMHTML header");
// |data| can be empty if the main frame should be skipped. If the main
- // frame is
- // skipped, then the whole archive is bad, so bail to the error condition.
+ // frame is skipped, then the whole archive is bad, so bail to the error
+ // condition.
WebData data = WebFrameSerializer::generateMHTMLHeader(
mhtml_boundary, GetWebFrame(), &delegate);
if (data.isEmpty() ||
@@ -5206,11 +5209,15 @@ void RenderFrameImpl::OnSerializeAsMHTML(
// skipping the whole parts generation step is not an error - it simply
// results in an omitted resource in the final file.
if (success) {
+ TRACE_EVENT0("page-serialization",
+ "RenderFrameImpl::OnSerializeAsMHTML parts serialization");
// |data| can be empty if the frame should be skipped, but this is OK.
data = WebFrameSerializer::generateMHTMLParts(mhtml_boundary, GetWebFrame(),
&delegate);
// TODO(jcivelli): write the chunks in deferred tasks to give a chance to
// the message loop to process other events.
+ TRACE_EVENT0("page-serialization",
+ "RenderFrameImpl::OnSerializeAsMHTML parts file writing");
if (!data.isEmpty() &&
file.WriteAtCurrentPos(data.data(), data.size()) < 0) {
success = false;
@@ -5219,6 +5226,8 @@ void RenderFrameImpl::OnSerializeAsMHTML(
// Generate MHTML footer if needed.
if (success && params.is_last_frame) {
+ TRACE_EVENT0("page-serialization",
+ "RenderFrameImpl::OnSerializeAsMHTML footer");
data = WebFrameSerializer::generateMHTMLFooter(mhtml_boundary);
if (file.WriteAtCurrentPos(data.data(), data.size()) < 0) {
success = false;
« no previous file with comments | « content/browser/download/mhtml_generation_manager.cc ('k') | third_party/WebKit/Source/core/frame/FrameSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698