| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/v8_inspector/V8ProfilerAgentImpl.h" | 5 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/Atomics.h" | 7 #include "platform/v8_inspector/Atomics.h" |
| 8 #include "platform/v8_inspector/V8InspectorImpl.h" | 8 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 10 #include "platform/v8_inspector/V8StackTraceImpl.h" | 10 #include "platform/v8_inspector/V8StackTraceImpl.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 const int childrenCount = node->GetChildrenCount(); | 54 const int childrenCount = node->GetChildrenCount(); |
| 55 for (int i = 0; i < childrenCount; i++) { | 55 for (int i = 0; i < childrenCount; i++) { |
| 56 const v8::CpuProfileNode* child = node->GetChild(i); | 56 const v8::CpuProfileNode* child = node->GetChild(i); |
| 57 children->addItem(buildInspectorObjectFor(isolate, child)); | 57 children->addItem(buildInspectorObjectFor(isolate, child)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> posit
ionTicks = buildInspectorObjectForPositionTicks(node); | 60 std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> posit
ionTicks = buildInspectorObjectForPositionTicks(node); |
| 61 | 61 |
| 62 std::unique_ptr<protocol::Runtime::CallFrame> callFrame = protocol::Runtime:
:CallFrame::create() | 62 std::unique_ptr<protocol::Runtime::CallFrame> callFrame = protocol::Runtime:
:CallFrame::create() |
| 63 .setFunctionName(toProtocolString(node->GetFunctionName())) | 63 .setFunctionName(toProtocolString(node->GetFunctionName())) |
| 64 .setScriptId(String16::fromInteger(node->GetScriptId())) | 64 .setScriptId(protocol::string16FromInteger(node->GetScriptId())) |
| 65 .setUrl(toProtocolString(node->GetScriptResourceName())) | 65 .setUrl(toProtocolString(node->GetScriptResourceName())) |
| 66 .setLineNumber(node->GetLineNumber() - 1) | 66 .setLineNumber(node->GetLineNumber() - 1) |
| 67 .setColumnNumber(node->GetColumnNumber() - 1) | 67 .setColumnNumber(node->GetColumnNumber() - 1) |
| 68 .build(); | 68 .build(); |
| 69 std::unique_ptr<protocol::Profiler::CPUProfileNode> result = protocol::Profi
ler::CPUProfileNode::create() | 69 std::unique_ptr<protocol::Profiler::CPUProfileNode> result = protocol::Profi
ler::CPUProfileNode::create() |
| 70 .setCallFrame(std::move(callFrame)) | 70 .setCallFrame(std::move(callFrame)) |
| 71 .setHitCount(node->GetHitCount()) | 71 .setHitCount(node->GetHitCount()) |
| 72 .setChildren(std::move(children)) | 72 .setChildren(std::move(children)) |
| 73 .setPositionTicks(std::move(positionTicks)) | 73 .setPositionTicks(std::move(positionTicks)) |
| 74 .setDeoptReason(node->GetBailoutReason()) | 74 .setDeoptReason(node->GetBailoutReason()) |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 *profile = std::move(cpuProfile); | 274 *profile = std::move(cpuProfile); |
| 275 if (!profile->get() && errorString) | 275 if (!profile->get() && errorString) |
| 276 *errorString = "Profile is not found"; | 276 *errorString = "Profile is not found"; |
| 277 } | 277 } |
| 278 m_frontendInitiatedProfileId = String16(); | 278 m_frontendInitiatedProfileId = String16(); |
| 279 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); | 279 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); |
| 280 } | 280 } |
| 281 | 281 |
| 282 String16 V8ProfilerAgentImpl::nextProfileId() | 282 String16 V8ProfilerAgentImpl::nextProfileId() |
| 283 { | 283 { |
| 284 return String16::fromInteger(atomicIncrement(&s_lastProfileId)); | 284 return protocol::string16FromInteger(atomicIncrement(&s_lastProfileId)); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void V8ProfilerAgentImpl::startProfiling(const String16& title) | 287 void V8ProfilerAgentImpl::startProfiling(const String16& title) |
| 288 { | 288 { |
| 289 v8::HandleScope handleScope(m_isolate); | 289 v8::HandleScope handleScope(m_isolate); |
| 290 profiler()->StartProfiling(toV8String(m_isolate, title), true); | 290 profiler()->StartProfiling(toV8String(m_isolate, title), true); |
| 291 } | 291 } |
| 292 | 292 |
| 293 std::unique_ptr<protocol::Profiler::CPUProfile> V8ProfilerAgentImpl::stopProfili
ng(const String16& title, bool serialize) | 293 std::unique_ptr<protocol::Profiler::CPUProfile> V8ProfilerAgentImpl::stopProfili
ng(const String16& title, bool serialize) |
| 294 { | 294 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 311 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() | 311 v8::CpuProfiler* V8ProfilerAgentImpl::profiler() |
| 312 { | 312 { |
| 313 #if ENSURE_V8_VERSION(5, 4) | 313 #if ENSURE_V8_VERSION(5, 4) |
| 314 return m_profiler; | 314 return m_profiler; |
| 315 #else | 315 #else |
| 316 return m_isolate->GetCpuProfiler(); | 316 return m_isolate->GetCpuProfiler(); |
| 317 #endif | 317 #endif |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |