Index: base/trace_event/blame_context.h |
diff --git a/base/trace_event/blame_context.h b/base/trace_event/blame_context.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b036676f62700037d49c01f675ae1fad14c9ed33 |
--- /dev/null |
+++ b/base/trace_event/blame_context.h |
@@ -0,0 +1,43 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_TRACE_EVENT_BLAME_CONTEXT_H_ |
+#define BASE_TRACE_EVENT_BLAME_CONTEXT_H_ |
+ |
+#include <inttypes.h> |
+ |
+#include "base/base_export.h" |
+#include "base/macros.h" |
+#include "base/trace_event/trace_event.h" |
+ |
+namespace base { |
+namespace trace_event { |
+ |
+// A blame context represents a logical unit to which we want to attribute |
+// different costs (e.g., CPU, network, or memory usage). An example of a blame |
+// context is an <iframe> element on a web page. Different subsystems can |
+// "enter" and "leave" blame contexts to indicate that they are doing work which |
+// should be accounted against this blame context. |
+class BASE_EXPORT BlameContext { |
+ public: |
+ // Indicate that the current thread is now doing work which should count |
+ // against this blame context. |
+ virtual void Enter() = 0; |
+ |
+ // Leave and stop doing work for a previously entered blame context. If |
+ // another blame context of the same type was entered prior to this one, it |
+ // becomes the active blame context for this thread again. |
+ virtual void Leave() = 0; |
+ |
+ protected: |
+ BlameContext() {} |
+ virtual ~BlameContext() {} |
danakj
2016/03/16 18:29:49
do you need to define this destructor? making a de
Sami
2016/03/17 12:27:13
I guess I wouldn't have needed this for the interf
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(BlameContext); |
+}; |
+ |
+} // namespace trace_event |
+} // namespace base |
+ |
+#endif // BASE_TRACE_EVENT_BLAME_CONTEXT_H_ |