OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project 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 "src/inspector/v8-profiler-agent-impl.h" | 5 #include "src/inspector/v8-profiler-agent-impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/inspector/protocol/Protocol.h" | 10 #include "src/inspector/protocol/Protocol.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 std::unique_ptr<protocol::Array<protocol::Profiler::FunctionCoverage>> | 300 std::unique_ptr<protocol::Array<protocol::Profiler::FunctionCoverage>> |
301 functions = | 301 functions = |
302 protocol::Array<protocol::Profiler::FunctionCoverage>::create(); | 302 protocol::Array<protocol::Profiler::FunctionCoverage>::create(); |
303 for (size_t j = 0; j < script_data.FunctionCount(); j++) { | 303 for (size_t j = 0; j < script_data.FunctionCount(); j++) { |
304 v8::debug::Coverage::FunctionData function_data = | 304 v8::debug::Coverage::FunctionData function_data = |
305 script_data.GetFunctionData(j); | 305 script_data.GetFunctionData(j); |
306 std::unique_ptr<protocol::Array<protocol::Profiler::CoverageRange>> | 306 std::unique_ptr<protocol::Array<protocol::Profiler::CoverageRange>> |
307 ranges = protocol::Array<protocol::Profiler::CoverageRange>::create(); | 307 ranges = protocol::Array<protocol::Profiler::CoverageRange>::create(); |
308 // At this point we only have per-function coverage data, so there is | 308 // At this point we only have per-function coverage data, so there is |
309 // only one range per function. | 309 // only one range per function. |
310 ranges->addItem( | 310 v8::debug::Location start = |
311 protocol::Profiler::CoverageRange::create() | 311 script->GetSourceLocation(function_data.StartOffset()); |
312 .setStartLineNumber(function_data.Start().GetLineNumber()) | 312 v8::debug::Location end = |
313 .setStartColumnNumber(function_data.Start().GetColumnNumber()) | 313 script->GetSourceLocation(function_data.EndOffset()); |
314 .setEndLineNumber(function_data.End().GetLineNumber()) | 314 ranges->addItem(protocol::Profiler::CoverageRange::create() |
315 .setEndColumnNumber(function_data.End().GetColumnNumber()) | 315 .setStartLineNumber(start.GetLineNumber()) |
316 .setCount(function_data.Count()) | 316 .setStartColumnNumber(start.GetColumnNumber()) |
317 .build()); | 317 .setEndLineNumber(end.GetLineNumber()) |
| 318 .setEndColumnNumber(end.GetColumnNumber()) |
| 319 .setStartOffset(function_data.StartOffset()) |
| 320 .setEndOffset(function_data.EndOffset()) |
| 321 .setCount(function_data.Count()) |
| 322 .build()); |
318 functions->addItem( | 323 functions->addItem( |
319 protocol::Profiler::FunctionCoverage::create() | 324 protocol::Profiler::FunctionCoverage::create() |
320 .setFunctionName(toProtocolString( | 325 .setFunctionName(toProtocolString( |
321 function_data.Name().FromMaybe(v8::Local<v8::String>()))) | 326 function_data.Name().FromMaybe(v8::Local<v8::String>()))) |
322 .setRanges(std::move(ranges)) | 327 .setRanges(std::move(ranges)) |
323 .build()); | 328 .build()); |
324 } | 329 } |
325 String16 url; | 330 String16 url; |
326 v8::Local<v8::String> name; | 331 v8::Local<v8::String> name; |
327 if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) { | 332 if (script->Name().ToLocal(&name) || script->SourceURL().ToLocal(&name)) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return m_profiler; | 402 return m_profiler; |
398 } | 403 } |
399 | 404 |
400 bool V8ProfilerAgentImpl::idleFinished() { | 405 bool V8ProfilerAgentImpl::idleFinished() { |
401 m_idle = false; | 406 m_idle = false; |
402 if (m_profiler) m_profiler->SetIdle(m_idle); | 407 if (m_profiler) m_profiler->SetIdle(m_idle); |
403 return m_profiler; | 408 return m_profiler; |
404 } | 409 } |
405 | 410 |
406 } // namespace v8_inspector | 411 } // namespace v8_inspector |
OLD | NEW |