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 |