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

Unified Diff: content/browser/devtools/protocol/tracing_handler.cc

Issue 1232313004: Add Tracing.requestMemoryDump method to DevTools API (tracing handler) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase after stubs landed Created 5 years, 5 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 | « content/browser/devtools/protocol/tracing_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/tracing_handler.cc
diff --git a/content/browser/devtools/protocol/tracing_handler.cc b/content/browser/devtools/protocol/tracing_handler.cc
index d3611b352c36b19a049eb67c24ee025fe9fe1812..66f54d21de2b8fdaf523f92f73f28fbebd2b845e 100644
--- a/content/browser/devtools/protocol/tracing_handler.cc
+++ b/content/browser/devtools/protocol/tracing_handler.cc
@@ -7,10 +7,12 @@
#include <cmath>
#include "base/bind.h"
+#include "base/format_macros.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_event_impl.h"
namespace content {
@@ -154,7 +156,24 @@ void TracingHandler::OnCategoriesReceived(
}
Response TracingHandler::RequestMemoryDump(DevToolsCommandId command_id) {
- return Response::InternalError("Not implemented");
+ if (!did_initiate_recording_)
+ return Response::InternalError("Tracing is not started");
+
+ base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump(
+ base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
+ base::Bind(&TracingHandler::OnMemoryDumpFinished,
+ weak_factory_.GetWeakPtr(), command_id));
+ return Response::OK();
+}
+
+void TracingHandler::OnMemoryDumpFinished(DevToolsCommandId command_id,
+ uint64 dump_guid,
+ bool success) {
+ client_->SendRequestMemoryDumpResponse(
+ command_id,
+ RequestMemoryDumpResponse::Create()
+ ->set_dump_guid(base::StringPrintf("0x%" PRIx64, dump_guid))
+ ->set_success(success));
}
void TracingHandler::SetupTimer(double usage_reporting_interval) {
« no previous file with comments | « content/browser/devtools/protocol/tracing_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698