OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "net/disk_cache/trace.h" | 5 #include "net/disk_cache/trace.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // Static. | 51 // Static. |
52 TraceObject* TraceObject::GetTraceObject() { | 52 TraceObject* TraceObject::GetTraceObject() { |
53 if (s_trace_object) | 53 if (s_trace_object) |
54 return s_trace_object; | 54 return s_trace_object; |
55 | 55 |
56 s_trace_object = new TraceObject(); | 56 s_trace_object = new TraceObject(); |
57 return s_trace_object; | 57 return s_trace_object; |
58 } | 58 } |
59 | 59 |
| 60 TraceObject::TraceObject() { |
| 61 InitTrace(); |
| 62 } |
| 63 |
| 64 TraceObject::~TraceObject() { |
| 65 DestroyTrace(); |
| 66 } |
| 67 |
60 #if ENABLE_TRACING | 68 #if ENABLE_TRACING |
61 | 69 |
62 static TraceBuffer* s_trace_buffer = NULL; | 70 static TraceBuffer* s_trace_buffer = NULL; |
63 | 71 |
64 void InitTrace(void) { | 72 void InitTrace(void) { |
65 if (s_trace_buffer) | 73 if (s_trace_buffer) |
66 return; | 74 return; |
67 | 75 |
68 s_trace_buffer = new TraceBuffer; | 76 s_trace_buffer = new TraceBuffer; |
69 memset(s_trace_buffer, 0, sizeof(*s_trace_buffer)); | 77 memset(s_trace_buffer, 0, sizeof(*s_trace_buffer)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void DestroyTrace(void) { | 148 void DestroyTrace(void) { |
141 s_trace_object = NULL; | 149 s_trace_object = NULL; |
142 } | 150 } |
143 | 151 |
144 void Trace(const char* format, ...) { | 152 void Trace(const char* format, ...) { |
145 } | 153 } |
146 | 154 |
147 #endif // ENABLE_TRACING | 155 #endif // ENABLE_TRACING |
148 | 156 |
149 } // namespace disk_cache | 157 } // namespace disk_cache |
OLD | NEW |