Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: net/disk_cache/blockfile/trace.h

Issue 1004593005: base::RefCounted now DCHECKs when referenced from multiple threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix lots of tests using UnsafeRefCounted. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_BLOCKFILE_TRACE_H_ 9 #ifndef NET_DISK_CACHE_BLOCKFILE_TRACE_H_
10 #define NET_DISK_CACHE_BLOCKFILE_TRACE_H_ 10 #define NET_DISK_CACHE_BLOCKFILE_TRACE_H_
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 15
16 namespace disk_cache { 16 namespace disk_cache {
17 17
18 // Create and destroy the tracing buffer. 18 // Create and destroy the tracing buffer.
19 void InitTrace(void); 19 void InitTrace(void);
20 void DestroyTrace(void); 20 void DestroyTrace(void);
21 21
22 // Simple class to handle the trace buffer lifetime. Any object interested in 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(). 23 // tracing should keep a reference to the object returned by GetTraceObject().
24 class TraceObject : public base::RefCounted<TraceObject> { 24 // TODO(mgiuca): Avoid using UnsafeRefCounted. http://crbug.com/469952.
25 friend class base::RefCounted<TraceObject>; 25 class TraceObject : public base::UnsafeRefCounted<TraceObject> {
26 friend class base::UnsafeRefCounted<TraceObject>;
27
26 public: 28 public:
27 static TraceObject* GetTraceObject(); 29 static TraceObject* GetTraceObject();
28 void EnableTracing(bool enable); 30 void EnableTracing(bool enable);
29 31
30 private: 32 private:
31 TraceObject(); 33 TraceObject();
32 ~TraceObject(); 34 ~TraceObject();
33 DISALLOW_COPY_AND_ASSIGN(TraceObject); 35 DISALLOW_COPY_AND_ASSIGN(TraceObject);
34 }; 36 };
35 37
36 // Traces to the internal buffer. 38 // Traces to the internal buffer.
37 NET_EXPORT_PRIVATE void Trace(const char* format, ...); 39 NET_EXPORT_PRIVATE void Trace(const char* format, ...);
38 40
39 } // namespace disk_cache 41 } // namespace disk_cache
40 42
41 #endif // NET_DISK_CACHE_BLOCKFILE_TRACE_H_ 43 #endif // NET_DISK_CACHE_BLOCKFILE_TRACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698