OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "remoting/base/tracer.h" | 5 #include "remoting/base/tracer.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void PrintLogs() { | 70 void PrintLogs() { |
71 while(!stopped_) { | 71 while(!stopped_) { |
72 TraceBuffer* buffer = NULL; | 72 TraceBuffer* buffer = NULL; |
73 { | 73 { |
74 base::AutoLock l(lock_); | 74 base::AutoLock l(lock_); |
75 if (buffers_.empty()) { | 75 if (buffers_.empty()) { |
76 wake_.Wait(); | 76 wake_.Wait(); |
77 } | 77 } |
78 // Check again since we might have woken for a stop signal. | 78 // Check again since we might have woken for a stop signal. |
79 if (buffers_.size() != 0) { | 79 if (!buffers_.empty()) { |
80 buffer = buffers_.back(); | 80 buffer = buffers_.back(); |
81 buffers_.pop_back(); | 81 buffers_.pop_back(); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 if (buffer) { | 85 if (buffer) { |
86 LogOneTrace(buffer); | 86 LogOneTrace(buffer); |
87 delete buffer; | 87 delete buffer; |
88 } | 88 } |
89 } | 89 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 void TraceContext::PopTracerInternal() { tracers_.pop_back(); } | 185 void TraceContext::PopTracerInternal() { tracers_.pop_back(); } |
186 | 186 |
187 Tracer* TraceContext::GetTracerInternal() { return tracers_.back(); } | 187 Tracer* TraceContext::GetTracerInternal() { return tracers_.back(); } |
188 | 188 |
189 | 189 |
190 } // namespace remoting | 190 } // namespace remoting |
191 | 191 |
192 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger); | 192 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger); |
OLD | NEW |