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) { |