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

Unified Diff: sky/engine/core/dom/Node.cpp

Issue 889823002: Remove TRACE_EVENT indirection through blink::Platform (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/dom/Document.cpp ('k') | sky/engine/core/dom/ScriptedAnimationController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/Node.cpp
diff --git a/sky/engine/core/dom/Node.cpp b/sky/engine/core/dom/Node.cpp
index 64c315f99f415a11a8c8d37e17c59aaee9bf8e5f..7749a7308a8f2d551f2bc8a6e131446623cdfb06 100644
--- a/sky/engine/core/dom/Node.cpp
+++ b/sky/engine/core/dom/Node.cpp
@@ -25,6 +25,7 @@
#include "sky/engine/config.h"
#include "sky/engine/core/dom/Node.h"
+#include "base/trace_event/trace_event_impl.h"
#include "gen/sky/core/HTMLNames.h"
#include "sky/engine/bindings/core/v8/DOMDataStore.h"
#include "sky/engine/bindings/core/v8/ExceptionState.h"
@@ -70,9 +71,9 @@
#include "sky/engine/core/page/Page.h"
#include "sky/engine/core/rendering/RenderBox.h"
#include "sky/engine/platform/EventDispatchForbiddenScope.h"
+#include "sky/engine/platform/JSONValues.h"
#include "sky/engine/platform/Partitions.h"
#include "sky/engine/platform/TraceEvent.h"
-#include "sky/engine/platform/TracedValue.h"
#include "sky/engine/wtf/HashSet.h"
#include "sky/engine/wtf/PassOwnPtr.h"
#include "sky/engine/wtf/RefCountedLeakCounter.h"
@@ -467,7 +468,21 @@ void Node::markAncestorsWithChildNeedsDistributionRecalc()
namespace {
-void addJsStack(TracedValue* stackFrames)
+class JSONTraceValue : public base::debug::ConvertableToTraceFormat {
+public:
+ explicit JSONTraceValue(RefPtr<JSONValue> value)
+ : m_value(value.release()) { }
+
+ void AppendAsTraceFormat(std::string* out) const override
+ {
+ out->append(m_value->toJSONString().utf8().data());
+ }
+
+private:
+ RefPtr<JSONValue> m_value;
+};
+
+void addJsStack(JSONArray* stackFrames)
{
RefPtr<ScriptCallStack> stack = createScriptCallStack(10);
if (!stack)
@@ -476,18 +491,18 @@ void addJsStack(TracedValue* stackFrames)
stackFrames->pushString(stack->at(i).functionName());
}
-PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForStyleInvalidation(unsigned nodeCount, const Node* rootNode)
+scoped_refptr<base::debug::ConvertableToTraceFormat> jsonObjectForStyleInvalidation(unsigned nodeCount, const Node* rootNode)
{
- RefPtr<TracedValue> value = TracedValue::create();
- value->setInteger("node_count", nodeCount);
+ RefPtr<JSONObject> value = JSONObject::create();
+ value->setNumber("node_count", nodeCount);
value->setString("root_node", rootNode->debugName());
- value->beginArray("js_stack");
- addJsStack(value.get());
- value->endArray();
- return value;
+ RefPtr<JSONArray> stack;
+ addJsStack(stack.get());
+ value->setArray("js_stack", stack.release());
+ return make_scoped_refptr(new JSONTraceValue(value));
}
-} // anonymous namespace'd functions supporting traceStyleChange
+} // namespace
unsigned Node::styledSubtreeSize() const
{
« no previous file with comments | « sky/engine/core/dom/Document.cpp ('k') | sky/engine/core/dom/ScriptedAnimationController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698