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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.h

Issue 2028523002: Attribute Stuff to Frames with FrameBlamer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check existence of BlameContext before using it Created 4 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
Index: third_party/WebKit/Source/core/frame/LocalFrame.h
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h
index 2e8d5735469ca7e5e96efa5604dde3135d0a1b97..0d351e0c44982a37129f44d42b0381dd3238ffdc 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.h
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.h
@@ -314,6 +314,30 @@ private:
Member<LocalFrame> m_frame;
};
+// A helper class for attributing cost inside a scope to a LocalFrame, with
+// output written to the trace log. The class is irrelevant to the core logic
+// of LocalFrame. Sample usage:
+//
+// void foo(LocalFrame* frame)
+// {
+// ScopedFrameBlamer frameBlamer(frame);
+// TRACE_EVENT0("blink", "foo");
+// // Do some real work...
+// }
+//
+// In Trace Viewer, we can find the cost of slice |foo| attributed to |frame|.
+// Design doc: https://docs.google.com/document/d/15BB-suCb9j-nFt55yCFJBJCGzLg2qUm3WaSOPb8APtI/edit?usp=sharing
+class ScopedFrameBlamer {
+ WTF_MAKE_NONCOPYABLE(ScopedFrameBlamer);
+ STACK_ALLOCATED();
+public:
+ explicit ScopedFrameBlamer(LocalFrame*);
+ ~ScopedFrameBlamer();
+
+private:
+ Member<LocalFrame> m_frame;
+};
+
} // namespace blink
#endif // LocalFrame_h

Powered by Google App Engine
This is Rietveld 408576698