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

Unified Diff: Source/core/dom/Node.cpp

Issue 357703002: Introduce builders for tracing event arguments (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed PLATFORM_EXPORT from template classes Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/core/inspector/InspectorTraceEvents.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 6dcd3c17be8b66e21cb985304f1785ac584c4b70..9e2f024b7424ea2628da3caa840a698c1bd53c07 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -696,24 +696,24 @@ void Node::markAncestorsWithChildNeedsDistributionRecalc()
namespace {
-PassRefPtr<JSONArray> jsStackAsJSONArray()
+void addJsStack(TracedArray<TracedValue>& stackFrames)
{
- RefPtr<JSONArray> jsonArray = JSONArray::create();
RefPtrWillBeRawPtr<ScriptCallStack> stack = createScriptCallStack(10);
if (!stack)
- return jsonArray.release();
+ return;
for (size_t i = 0; i < stack->size(); i++)
- jsonArray->pushString(stack->at(i).functionName());
- return jsonArray.release();
+ stackFrames.pushString(stack->at(i).functionName());
}
-PassRefPtr<JSONObject> jsonObjectForStyleInvalidation(unsigned nodeCount, const Node* rootNode)
+PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForStyleInvalidation(unsigned nodeCount, const Node* rootNode)
{
- RefPtr<JSONObject> jsonObject = JSONObject::create();
- jsonObject->setNumber("node_count", nodeCount);
- jsonObject->setString("root_node", rootNode->debugName());
- jsonObject->setArray("js_stack", jsStackAsJSONArray());
- return jsonObject.release();
+ TracedValue value;
+ value.setInteger("node_count", nodeCount);
+ value.setString("root_node", rootNode->debugName());
+ TracedArray<TracedValue>& array = value.beginArray("js_stack");
+ addJsStack(array);
+ array.endArray();
+ return value.finish();
}
} // anonymous namespace'd functions supporting traceStyleChange
@@ -741,7 +741,7 @@ void Node::traceStyleChange(StyleChangeType changeType)
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("style.debug"),
"Node::setNeedsStyleRecalc",
- "data", TracedValue::fromJSONValue(jsonObjectForStyleInvalidation(nodeCount, this))
+ "data", jsonObjectForStyleInvalidation(nodeCount, this)
);
}
« no previous file with comments | « no previous file | Source/core/inspector/InspectorTraceEvents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698