| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_FILES_FILE_TRACING_H_ | 5 #ifndef BASE_FILES_FILE_TRACING_H_ |
| 6 #define BASE_FILES_FILE_TRACING_H_ | 6 #define BASE_FILES_FILE_TRACING_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 | 11 |
| 12 #define FILE_TRACING_PREFIX "File" | 12 #define FILE_TRACING_PREFIX "File" |
| 13 | 13 |
| 14 #define SCOPED_FILE_TRACE_WITH_SIZE(name, size) \ | 14 #define SCOPED_FILE_TRACE_WITH_SIZE(name, size) \ |
| 15 FileTracing::ScopedTrace scoped_file_trace; \ | 15 FileTracing::ScopedTrace scoped_file_trace; \ |
| 16 if (scoped_file_trace.ShouldInitialize()) \ | 16 if (scoped_file_trace.ShouldInitialize()) \ |
| 17 scoped_file_trace.Initialize(FILE_TRACING_PREFIX "::" name, this, size) | 17 scoped_file_trace.Initialize(FILE_TRACING_PREFIX "::" name, this, size) |
| 18 | 18 |
| 19 #define SCOPED_FILE_TRACE(name) SCOPED_FILE_TRACE_WITH_SIZE(name, 0) | 19 #define SCOPED_FILE_TRACE(name) SCOPED_FILE_TRACE_WITH_SIZE(name, 0) |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 | 22 |
| 23 class File; | 23 class File; |
| 24 class FilePath; | 24 class FilePath; |
| 25 | 25 |
| 26 class BASE_EXPORT FileTracing { | 26 class BASE_EXPORT FileTracing { |
| 27 public: | 27 public: |
| 28 class Provider { | 28 class Provider { |
| 29 public: | 29 public: |
| 30 virtual ~Provider() = default; |
| 31 |
| 30 // Whether the file tracing category is currently enabled. | 32 // Whether the file tracing category is currently enabled. |
| 31 virtual bool FileTracingCategoryIsEnabled() const = 0; | 33 virtual bool FileTracingCategoryIsEnabled() const = 0; |
| 32 | 34 |
| 33 // Enables file tracing for |id|. Must be called before recording events. | 35 // Enables file tracing for |id|. Must be called before recording events. |
| 34 virtual void FileTracingEnable(void* id) = 0; | 36 virtual void FileTracingEnable(void* id) = 0; |
| 35 | 37 |
| 36 // Disables file tracing for |id|. | 38 // Disables file tracing for |id|. |
| 37 virtual void FileTracingDisable(void* id) = 0; | 39 virtual void FileTracingDisable(void* id) = 0; |
| 38 | 40 |
| 39 // Begins an event for |id| with |name|. |path| tells where in the directory | 41 // Begins an event for |id| with |name|. |path| tells where in the directory |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 83 |
| 82 DISALLOW_COPY_AND_ASSIGN(ScopedTrace); | 84 DISALLOW_COPY_AND_ASSIGN(ScopedTrace); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 DISALLOW_COPY_AND_ASSIGN(FileTracing); | 87 DISALLOW_COPY_AND_ASSIGN(FileTracing); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace base | 90 } // namespace base |
| 89 | 91 |
| 90 #endif // BASE_FILES_FILE_TRACING_H_ | 92 #endif // BASE_FILES_FILE_TRACING_H_ |
| OLD | NEW |