| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/devtools/protocol/tracing_handler.h" | 5 #include "content/browser/devtools/protocol/tracing_handler.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 for (const std::string& category : category_set) | 152 for (const std::string& category : category_set) |
| 153 categories.push_back(category); | 153 categories.push_back(category); |
| 154 client_->SendGetCategoriesResponse(command_id, | 154 client_->SendGetCategoriesResponse(command_id, |
| 155 GetCategoriesResponse::Create()->set_categories(categories)); | 155 GetCategoriesResponse::Create()->set_categories(categories)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 Response TracingHandler::RequestMemoryDump(DevToolsCommandId command_id) { | 158 Response TracingHandler::RequestMemoryDump(DevToolsCommandId command_id) { |
| 159 if (!did_initiate_recording_) | 159 if (!did_initiate_recording_) |
| 160 return Response::InternalError("Tracing is not started"); | 160 return Response::InternalError("Tracing is not started"); |
| 161 | 161 |
| 162 base::trace_event::MemoryDumpArgs dump_args = { | |
| 163 base::trace_event::MemoryDumpArgs::LEVEL_OF_DETAIL_HIGH}; | |
| 164 base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump( | 162 base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump( |
| 165 base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, dump_args, | 163 base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 166 base::Bind(&TracingHandler::OnMemoryDumpFinished, | 164 base::Bind(&TracingHandler::OnMemoryDumpFinished, |
| 167 weak_factory_.GetWeakPtr(), command_id)); | 165 weak_factory_.GetWeakPtr(), command_id)); |
| 168 return Response::OK(); | 166 return Response::OK(); |
| 169 } | 167 } |
| 170 | 168 |
| 171 void TracingHandler::OnMemoryDumpFinished(DevToolsCommandId command_id, | 169 void TracingHandler::OnMemoryDumpFinished(DevToolsCommandId command_id, |
| 172 uint64 dump_guid, | 170 uint64 dump_guid, |
| 173 bool success) { | 171 bool success) { |
| 174 client_->SendRequestMemoryDumpResponse( | 172 client_->SendRequestMemoryDumpResponse( |
| 175 command_id, | 173 command_id, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 203 did_initiate_recording_ = false; | 201 did_initiate_recording_ = false; |
| 204 } | 202 } |
| 205 | 203 |
| 206 bool TracingHandler::IsRecording() const { | 204 bool TracingHandler::IsRecording() const { |
| 207 return TracingController::GetInstance()->IsRecording(); | 205 return TracingController::GetInstance()->IsRecording(); |
| 208 } | 206 } |
| 209 | 207 |
| 210 } // namespace tracing | 208 } // namespace tracing |
| 211 } // namespace devtools | 209 } // namespace devtools |
| 212 } // namespace content | 210 } // namespace content |
| OLD | NEW |