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

Unified Diff: content/browser/download/mhtml_generation_manager.cc

Issue 2344153003: Adds tracing to MHTML generation call chain. (Closed)
Patch Set: Fixed build error due to trace string argument not being correctly handled. 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/browser/download/mhtml_generation_manager.cc
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc
index f28c86f1c01d55630d372754c63943186a21551c..268ea9819542fb50a728ad5bd08d71686a15b7fb 100644
--- a/content/browser/download/mhtml_generation_manager.cc
+++ b/content/browser/download/mhtml_generation_manager.cc
@@ -15,6 +15,7 @@
#include "base/scoped_observer.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
+#include "base/trace_event/trace_event.h"
#include "content/browser/bad_message.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
@@ -223,6 +224,8 @@ bool MHTMLGenerationManager::Job::SendToNextRenderFrame() {
frame_tree_node_id_of_busy_frame_);
frame_tree_node_id_of_busy_frame_ = frame_tree_node_id;
rfh->Send(new FrameMsg_SerializeAsMHTML(rfh->GetRoutingID(), ipc_params));
esprehn 2016/09/21 00:14:57 we really need to rewrite this with mojo and move
carlosk 2016/09/21 16:47:19 Acknowledged.
+ TRACE_EVENT_NESTABLE_ASYNC_BEGIN1("page-serialization", "WaitingOnRenderer",
+ this, "tree node id", frame_tree_node_id);
Łukasz Anforowicz 2016/09/20 22:44:59 nit: Would it be worth spelling out "frame tree no
carlosk 2016/09/21 16:47:20 Done.
return true;
}
@@ -237,6 +240,8 @@ void MHTMLGenerationManager::Job::RenderProcessExited(
void MHTMLGenerationManager::Job::MarkAsFinished() {
DCHECK(!is_finished_);
is_finished_ = true;
+ TRACE_EVENT_NESTABLE_ASYNC_INSTANT0("page-serialization", "JobFinished",
+ this);
// Stopping RenderProcessExited notifications is needed to avoid calling
// JobFinished twice. See also https://crbug.com/612098.
@@ -330,6 +335,10 @@ void MHTMLGenerationManager::SaveMHTML(WebContents* web_contents,
DCHECK_CURRENTLY_ON(BrowserThread::UI);
int job_id = NewJob(web_contents, params, callback);
+ TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(
+ "page-serialization", "SavingMhtmlJob", FindJob(job_id), "url",
Łukasz Anforowicz 2016/09/20 22:44:59 FindJob above looks weird (maybe just to me :-).
carlosk 2016/09/21 16:47:19 Sounds better to me too. Done. This mapping shoul
+ web_contents->GetLastCommittedURL().spec().c_str(), "file",
Łukasz Anforowicz 2016/09/20 22:44:59 I don't know if GetLastCommittedURL is guaranteed
carlosk 2016/09/21 16:47:19 If the URL was committed it must be valid otherwis
+ params.file_path.value().c_str());
BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::FILE, FROM_HERE,
@@ -354,6 +363,9 @@ void MHTMLGenerationManager::OnSerializeAsMHTMLResponse(
return;
}
+ TRACE_EVENT_NESTABLE_ASYNC_END0("page-serialization", "WaitingOnRenderer",
+ job);
+
if (!mhtml_generation_in_renderer_succeeded) {
JobFinished(job, JobStatus::FAILURE);
return;
@@ -426,6 +438,10 @@ void MHTMLGenerationManager::OnFileClosed(int job_id,
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Job* job = FindJob(job_id);
+ TRACE_EVENT_NESTABLE_ASYNC_END2(
+ "page-serialization", "SavingMhtmlJob", job, "job result",
+ job_status == JobStatus::SUCCESS ? "success" : "failure", "file size",
+ file_size);
job->callback().Run(job_status == JobStatus::SUCCESS ? file_size : -1);
id_to_job_.erase(job_id);
delete job;
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | third_party/WebKit/Source/web/WebFrameSerializer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698