OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file provides support for basic in-memory tracing of short events. We | 5 // This file provides support for basic in-memory tracing of short events. We |
6 // keep a static circular buffer where we store the last traced events, so we | 6 // keep a static circular buffer where we store the last traced events, so we |
7 // can review the cache recent behavior should we need it. | 7 // can review the cache recent behavior should we need it. |
8 | 8 |
9 #ifndef NET_DISK_CACHE_TRACE_H__ | 9 #ifndef NET_DISK_CACHE_TRACE_H__ |
10 #define NET_DISK_CACHE_TRACE_H__ | 10 #define NET_DISK_CACHE_TRACE_H__ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "net/base/net_api.h" | 15 #include "net/base/net_export.h" |
16 | 16 |
17 namespace disk_cache { | 17 namespace disk_cache { |
18 | 18 |
19 // Create and destroy the tracing buffer. | 19 // Create and destroy the tracing buffer. |
20 void InitTrace(void); | 20 void InitTrace(void); |
21 void DestroyTrace(void); | 21 void DestroyTrace(void); |
22 | 22 |
23 // Simple class to handle the trace buffer lifetime. Any object interested in | 23 // Simple class to handle the trace buffer lifetime. Any object interested in |
24 // tracing should keep a reference to the object returned by GetTraceObject(). | 24 // tracing should keep a reference to the object returned by GetTraceObject(). |
25 class TraceObject : public base::RefCounted<TraceObject> { | 25 class TraceObject : public base::RefCounted<TraceObject> { |
26 friend class base::RefCounted<TraceObject>; | 26 friend class base::RefCounted<TraceObject>; |
27 public: | 27 public: |
28 static TraceObject* GetTraceObject(); | 28 static TraceObject* GetTraceObject(); |
29 | 29 |
30 private: | 30 private: |
31 TraceObject(); | 31 TraceObject(); |
32 ~TraceObject(); | 32 ~TraceObject(); |
33 DISALLOW_COPY_AND_ASSIGN(TraceObject); | 33 DISALLOW_COPY_AND_ASSIGN(TraceObject); |
34 }; | 34 }; |
35 | 35 |
36 // Traces to the internal buffer. | 36 // Traces to the internal buffer. |
37 NET_TEST void Trace(const char* format, ...); | 37 NET_EXPORT_PRIVATE void Trace(const char* format, ...); |
38 | 38 |
39 } // namespace disk_cache | 39 } // namespace disk_cache |
40 | 40 |
41 #endif // NET_DISK_CACHE_TRACE_H__ | 41 #endif // NET_DISK_CACHE_TRACE_H__ |
OLD | NEW |