diff options
Diffstat (limited to 'base/files/file_tracing.h')
-rw-r--r-- | base/files/file_tracing.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/base/files/file_tracing.h b/base/files/file_tracing.h index aca1ff7546..bedd7be64b 100644 --- a/base/files/file_tracing.h +++ b/base/files/file_tracing.h @@ -5,15 +5,16 @@ #ifndef BASE_FILES_FILE_TRACING_H_ #define BASE_FILES_FILE_TRACING_H_ +#include <stdint.h> + #include "base/base_export.h" -#include "base/basictypes.h" #include "base/macros.h" #define FILE_TRACING_PREFIX "File" #define SCOPED_FILE_TRACE_WITH_SIZE(name, size) \ FileTracing::ScopedTrace scoped_file_trace; \ - if (scoped_file_trace.ShouldInitialize()) \ + if (FileTracing::IsCategoryEnabled()) \ scoped_file_trace.Initialize(FILE_TRACING_PREFIX "::" name, this, size) #define SCOPED_FILE_TRACE(name) SCOPED_FILE_TRACE_WITH_SIZE(name, 0) @@ -25,6 +26,9 @@ class FilePath; class BASE_EXPORT FileTracing { public: + // Whether the file tracing category is enabled. + static bool IsCategoryEnabled(); + class Provider { public: virtual ~Provider() = default; @@ -41,8 +45,10 @@ class BASE_EXPORT FileTracing { // Begins an event for |id| with |name|. |path| tells where in the directory // structure the event is happening (and may be blank). |size| is the number // of bytes involved in the event. - virtual void FileTracingEventBegin( - const char* name, void* id, const FilePath& path, int64 size) = 0; + virtual void FileTracingEventBegin(const char* name, + void* id, + const FilePath& path, + int64_t size) = 0; // Ends an event for |id| with |name|. virtual void FileTracingEventEnd(const char* name, void* id) = 0; @@ -63,14 +69,11 @@ class BASE_EXPORT FileTracing { ScopedTrace(); ~ScopedTrace(); - // Whether this trace should be initialized or not. - bool ShouldInitialize() const; - // Called only if the tracing category is enabled. |name| is the name of the // event to trace (e.g. "Read", "Write") and must have an application // lifetime (e.g. static or literal). |file| is the file being traced; must // outlive this class. |size| is the size (in bytes) of this event. - void Initialize(const char* name, File* file, int64 size); + void Initialize(const char* name, File* file, int64_t size); private: // The ID of this trace. Based on the |file| passed to |Initialize()|. Must |