Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / net / disk_cache / blockfile / trace.h
blob6805e6c60c27dedd06f69e8f4572afa3d5181669
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
3 // found in the LICENSE file.
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
7 // can review the cache recent behavior should we need it.
9 #ifndef NET_DISK_CACHE_BLOCKFILE_TRACE_H_
10 #define NET_DISK_CACHE_BLOCKFILE_TRACE_H_
12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h"
14 #include "net/base/net_export.h"
16 namespace disk_cache {
18 // Create and destroy the tracing buffer.
19 void InitTrace(void);
20 void DestroyTrace(void);
22 // Simple class to handle the trace buffer lifetime. Any object interested in
23 // tracing should keep a reference to the object returned by GetTraceObject().
24 class TraceObject : public base::RefCounted<TraceObject> {
25 friend class base::RefCounted<TraceObject>;
26 public:
27 static TraceObject* GetTraceObject();
28 void EnableTracing(bool enable);
30 private:
31 TraceObject();
32 ~TraceObject();
33 DISALLOW_COPY_AND_ASSIGN(TraceObject);
36 // Traces to the internal buffer.
37 NET_EXPORT_PRIVATE void Trace(const char* format, ...);
39 } // namespace disk_cache
41 #endif // NET_DISK_CACHE_BLOCKFILE_TRACE_H_