blob: 99a35bdad655ba0119a3a7e0b5c6e729e8537380 [file] [log] [blame]
[email protected]3b63f8f42011-03-28 01:54:151// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit586acc5fe2008-07-26 22:42:524
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.
8
9#ifndef NET_DISK_CACHE_TRACE_H__
10#define NET_DISK_CACHE_TRACE_H__
[email protected]32b76ef2010-07-26 23:08:2411#pragma once
initial.commit586acc5fe2008-07-26 22:42:5212
initial.commit586acc5fe2008-07-26 22:42:5213#include "base/basictypes.h"
[email protected]3b63f8f42011-03-28 01:54:1514#include "base/memory/ref_counted.h"
[email protected]172da1b2011-08-12 15:52:2615#include "net/base/net_export.h"
initial.commit586acc5fe2008-07-26 22:42:5216
17namespace disk_cache {
18
19// Create and destroy the tracing buffer.
[email protected]6192f732009-03-25 23:44:2020void InitTrace(void);
initial.commit586acc5fe2008-07-26 22:42:5221void DestroyTrace(void);
22
[email protected]6192f732009-03-25 23:44:2023// Simple class to handle the trace buffer lifetime. Any object interested in
24// tracing should keep a reference to the object returned by GetTraceObject().
25class TraceObject : public base::RefCounted<TraceObject> {
26 friend class base::RefCounted<TraceObject>;
initial.commit586acc5fe2008-07-26 22:42:5227 public:
[email protected]6192f732009-03-25 23:44:2028 static TraceObject* GetTraceObject();
29
30 private:
[email protected]d4799a32010-09-28 22:54:5831 TraceObject();
32 ~TraceObject();
[email protected]73a797fb2010-06-07 02:10:1833 DISALLOW_COPY_AND_ASSIGN(TraceObject);
initial.commit586acc5fe2008-07-26 22:42:5234};
35
36// Traces to the internal buffer.
[email protected]172da1b2011-08-12 15:52:2637NET_EXPORT_PRIVATE void Trace(const char* format, ...);
initial.commit586acc5fe2008-07-26 22:42:5238
39} // namespace disk_cache
40
41#endif // NET_DISK_CACHE_TRACE_H__