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

Unified Diff: net/disk_cache/trace.cc

Issue 49027: Disk cache: First pass to make it possible to have... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/trace.h ('k') | net/http/http_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/trace.cc
===================================================================
--- net/disk_cache/trace.cc (revision 12517)
+++ net/disk_cache/trace.cc (working copy)
@@ -42,24 +42,37 @@
namespace disk_cache {
+// s_trace_buffer and s_trace_object are not singletons because I want the
+// buffer to be destroyed and re-created when the last user goes away, and it
+// must be straightforward to access the buffer from the debugger.
+static TraceObject* s_trace_object = NULL;
+
+// Static.
+TraceObject* TraceObject::GetTraceObject() {
+ if (s_trace_object)
+ return s_trace_object;
+
+ s_trace_object = new TraceObject();
+ return s_trace_object;
+}
+
#if ENABLE_TRACING
static TraceBuffer* s_trace_buffer = NULL;
-bool InitTrace(void) {
- DCHECK(!s_trace_buffer);
+void InitTrace(void) {
if (s_trace_buffer)
- return false;
+ return;
s_trace_buffer = new TraceBuffer;
memset(s_trace_buffer, 0, sizeof(*s_trace_buffer));
- return true;
}
void DestroyTrace(void) {
DCHECK(s_trace_buffer);
delete s_trace_buffer;
s_trace_buffer = NULL;
+ s_trace_object = NULL;
}
void Trace(const char* format, ...) {
@@ -118,11 +131,12 @@
#else // ENABLE_TRACING
-bool InitTrace(void) {
- return true;
+void InitTrace(void) {
+ return;
}
void DestroyTrace(void) {
+ s_trace_object = NULL;
}
void Trace(const char* format, ...) {
« no previous file with comments | « net/disk_cache/trace.h ('k') | net/http/http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698