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

Side by Side Diff: remoting/base/tracer.cc

Issue 3814013: FBTF: Monster ctor patch after changing heuristics in clang plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: More add file fail Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « remoting/base/tracer.h ('k') | remoting/host/client_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
14 #include "base/stl_util-inl.h" 14 #include "base/stl_util-inl.h"
15 #include "base/thread.h" 15 #include "base/thread.h"
16 #include "base/thread_local.h"
16 #include "base/time.h" 17 #include "base/time.h"
17 18
18 namespace remoting { 19 namespace remoting {
19 20
20 namespace { 21 namespace {
21 22
22 class OutputLogger { 23 class OutputLogger {
23 public: 24 public:
24 OutputLogger() 25 OutputLogger()
25 : thread_("logging_thread"), 26 : thread_("logging_thread"),
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 133 }
133 134
134 Tracer::~Tracer() { 135 Tracer::~Tracer() {
135 AutoLock l(lock_); 136 AutoLock l(lock_);
136 137
137 if (buffer_.get()) { 138 if (buffer_.get()) {
138 Singleton<OutputLogger>::get()->OutputTrace(buffer_.release()); 139 Singleton<OutputLogger>::get()->OutputTrace(buffer_.release());
139 } 140 }
140 } 141 }
141 142
143 // static
144 Tracer* TraceContext::tracer() {
145 return Get()->GetTracerInternal();
146 }
147
148 // static
149 void TraceContext::PushTracer(Tracer* tracer) {
150 Get()->PushTracerInternal(tracer);
151 }
152
153 // static
154 void TraceContext::PopTracer() {
155 Get()->PopTracerInternal();
156 }
157
158 // static
159 TraceContext* TraceContext::Get() {
160 TraceContext* context =
161 Singleton<base::ThreadLocalPointer<TraceContext> >::get()->Get();
162 if (context == NULL) {
163 context = new TraceContext();
164 context->PushTracerInternal(new Tracer("default", 0.0));
165 Singleton<base::ThreadLocalPointer<TraceContext> >::get()->Set(context);
166 }
167 return context;
168 }
169
170 TraceContext::TraceContext() {}
171
172 TraceContext::~TraceContext() {}
173
174 void TraceContext::PushTracerInternal(Tracer* tracer) {
175 tracers_.push_back(tracer);
176 }
177
178 void TraceContext::PopTracerInternal() { tracers_.pop_back(); }
179
180 Tracer* TraceContext::GetTracerInternal() { return tracers_.back(); }
181
182
142 } // namespace remoting 183 } // namespace remoting
143 184
144 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger); 185 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger);
OLDNEW
« no previous file with comments | « remoting/base/tracer.h ('k') | remoting/host/client_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698