Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp

Issue 2248963007: DevTools: Make children field of the CpuProfileNode optional in the protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
index a7df3142b2f32bd26d3fa15c7b4061625f2292d5..0709effa2bf5d432c378774658ceb4e3accc1f04 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
@@ -50,13 +50,7 @@ std::unique_ptr<protocol::Profiler::CPUProfileNode> buildInspectorObjectFor(v8::
{
v8::HandleScope handleScope(isolate);
- std::unique_ptr<protocol::Array<int>> children = protocol::Array<int>::create();
- const int childrenCount = node->GetChildrenCount();
- for (int i = 0; i < childrenCount; i++)
- children->addItem(node->GetChild(i)->GetNodeId());
-
std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> positionTicks = buildInspectorObjectForPositionTicks(node);
-
std::unique_ptr<protocol::Runtime::CallFrame> callFrame = protocol::Runtime::CallFrame::create()
.setFunctionName(toProtocolString(node->GetFunctionName()))
.setScriptId(String16::fromInteger(node->GetScriptId()))
@@ -67,10 +61,17 @@ std::unique_ptr<protocol::Profiler::CPUProfileNode> buildInspectorObjectFor(v8::
std::unique_ptr<protocol::Profiler::CPUProfileNode> result = protocol::Profiler::CPUProfileNode::create()
.setCallFrame(std::move(callFrame))
.setHitCount(node->GetHitCount())
- .setChildren(std::move(children))
.setPositionTicks(std::move(positionTicks))
.setDeoptReason(node->GetBailoutReason())
.setId(node->GetNodeId()).build();
+
+ const int childrenCount = node->GetChildrenCount();
+ if (childrenCount) {
+ std::unique_ptr<protocol::Array<int>> children = protocol::Array<int>::create();
+ for (int i = 0; i < childrenCount; i++)
+ children->addItem(node->GetChild(i)->GetNodeId());
+ result->setChildren(std::move(children));
+ }
return result;
}

Powered by Google App Engine
This is Rietveld 408576698