| 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}; |
| 162 base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump( | 164 base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump( |
| 163 base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, | 165 base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, dump_args, |
| 164 base::Bind(&TracingHandler::OnMemoryDumpFinished, | 166 base::Bind(&TracingHandler::OnMemoryDumpFinished, |
| 165 weak_factory_.GetWeakPtr(), command_id)); | 167 weak_factory_.GetWeakPtr(), command_id)); |
| 166 return Response::OK(); | 168 return Response::OK(); |
| 167 } | 169 } |
| 168 | 170 |
| 169 void TracingHandler::OnMemoryDumpFinished(DevToolsCommandId command_id, | 171 void TracingHandler::OnMemoryDumpFinished(DevToolsCommandId command_id, |
| 170 uint64 dump_guid, | 172 uint64 dump_guid, |
| 171 bool success) { | 173 bool success) { |
| 172 client_->SendRequestMemoryDumpResponse( | 174 client_->SendRequestMemoryDumpResponse( |
| 173 command_id, | 175 command_id, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 201 did_initiate_recording_ = false; | 203 did_initiate_recording_ = false; |
| 202 } | 204 } |
| 203 | 205 |
| 204 bool TracingHandler::IsRecording() const { | 206 bool TracingHandler::IsRecording() const { |
| 205 return TracingController::GetInstance()->IsRecording(); | 207 return TracingController::GetInstance()->IsRecording(); |
| 206 } | 208 } |
| 207 | 209 |
| 208 } // namespace tracing | 210 } // namespace tracing |
| 209 } // namespace devtools | 211 } // namespace devtools |
| 210 } // namespace content | 212 } // namespace content |
| OLD | NEW |