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/condition_variable.h" | 10 #include "base/condition_variable.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/platform_thread.h" |
13 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
14 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
15 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
16 #include "base/thread.h" | 17 #include "base/thread.h" |
17 #include "base/threading/thread_local.h" | 18 #include "base/threading/thread_local.h" |
18 #include "base/time.h" | 19 #include "base/time.h" |
19 | 20 |
20 namespace remoting { | 21 namespace remoting { |
21 | 22 |
22 namespace { | 23 namespace { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (!buffer_.get()) { | 129 if (!buffer_.get()) { |
129 return; | 130 return; |
130 } | 131 } |
131 | 132 |
132 TraceRecord* record = buffer_->add_record(); | 133 TraceRecord* record = buffer_->add_record(); |
133 record->set_annotation(s); | 134 record->set_annotation(s); |
134 record->set_timestamp(base::Time::Now().ToInternalValue()); | 135 record->set_timestamp(base::Time::Now().ToInternalValue()); |
135 | 136 |
136 // Take the pointer for the current messageloop as identifying for the | 137 // Take the pointer for the current messageloop as identifying for the |
137 // current thread. | 138 // current thread. |
138 record->set_thread_id(static_cast<uint64>(PlatformThread::CurrentId())); | 139 record->set_thread_id(static_cast<uint64>(base::PlatformThread::CurrentId())); |
139 } | 140 } |
140 | 141 |
141 Tracer::~Tracer() { | 142 Tracer::~Tracer() { |
142 AutoLock l(lock_); | 143 AutoLock l(lock_); |
143 | 144 |
144 if (buffer_.get()) { | 145 if (buffer_.get()) { |
145 g_output_logger.Get().OutputTrace(buffer_.release()); | 146 g_output_logger.Get().OutputTrace(buffer_.release()); |
146 } | 147 } |
147 } | 148 } |
148 | 149 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 183 } |
183 | 184 |
184 void TraceContext::PopTracerInternal() { tracers_.pop_back(); } | 185 void TraceContext::PopTracerInternal() { tracers_.pop_back(); } |
185 | 186 |
186 Tracer* TraceContext::GetTracerInternal() { return tracers_.back(); } | 187 Tracer* TraceContext::GetTracerInternal() { return tracers_.back(); } |
187 | 188 |
188 | 189 |
189 } // namespace remoting | 190 } // namespace remoting |
190 | 191 |
191 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger); | 192 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger); |
OLD | NEW |