Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_TRACE_EVENT_BLAME_CONTEXT_H_ | |
| 6 #define BASE_TRACE_EVENT_BLAME_CONTEXT_H_ | |
| 7 | |
| 8 #include <inttypes.h> | |
| 9 | |
| 10 #include "base/base_export.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/trace_event/trace_event.h" | |
| 13 | |
| 14 namespace base { | |
| 15 namespace trace_event { | |
| 16 | |
| 17 // A blame context represents a logical unit to which we want to attribute | |
| 18 // different costs (e.g., CPU, network, or memory usage). An example of a blame | |
| 19 // context is an <iframe> element on a web page. Different subsystems can | |
| 20 // "enter" and "leave" blame contexts to indicate that they are doing work which | |
| 21 // should be accounted against this blame context. | |
| 22 class BASE_EXPORT BlameContext { | |
| 23 public: | |
| 24 // Indicate that the current thread is now doing work which should count | |
| 25 // against this blame context. | |
| 26 virtual void Enter() = 0; | |
| 27 | |
| 28 // Leave and stop doing work for a previously entered blame context. If | |
| 29 // another blame context of the same type was entered prior to this one, it | |
| 30 // becomes the active blame context for this thread again. | |
| 31 virtual void Leave() = 0; | |
| 32 | |
| 33 protected: | |
| 34 BlameContext() {} | |
| 35 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
| |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(BlameContext); | |
| 38 }; | |
| 39 | |
| 40 } // namespace trace_event | |
| 41 } // namespace base | |
| 42 | |
| 43 #endif // BASE_TRACE_EVENT_BLAME_CONTEXT_H_ | |
| OLD | NEW |