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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/base/tracer.h ('k') | remoting/host/client_connection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/tracer.cc
diff --git a/remoting/base/tracer.cc b/remoting/base/tracer.cc
index c9df2f0d30fa6a651f4ad2fcf4e62e320a57d681..29b2b626a4141ac252246946926ca8173f43faf5 100644
--- a/remoting/base/tracer.cc
+++ b/remoting/base/tracer.cc
@@ -13,6 +13,7 @@
#include "base/ref_counted.h"
#include "base/stl_util-inl.h"
#include "base/thread.h"
+#include "base/thread_local.h"
#include "base/time.h"
namespace remoting {
@@ -139,6 +140,46 @@ Tracer::~Tracer() {
}
}
+// static
+Tracer* TraceContext::tracer() {
+ return Get()->GetTracerInternal();
+}
+
+// static
+void TraceContext::PushTracer(Tracer* tracer) {
+ Get()->PushTracerInternal(tracer);
+}
+
+// static
+void TraceContext::PopTracer() {
+ Get()->PopTracerInternal();
+}
+
+// static
+TraceContext* TraceContext::Get() {
+ TraceContext* context =
+ Singleton<base::ThreadLocalPointer<TraceContext> >::get()->Get();
+ if (context == NULL) {
+ context = new TraceContext();
+ context->PushTracerInternal(new Tracer("default", 0.0));
+ Singleton<base::ThreadLocalPointer<TraceContext> >::get()->Set(context);
+ }
+ return context;
+}
+
+TraceContext::TraceContext() {}
+
+TraceContext::~TraceContext() {}
+
+void TraceContext::PushTracerInternal(Tracer* tracer) {
+ tracers_.push_back(tracer);
+}
+
+void TraceContext::PopTracerInternal() { tracers_.pop_back(); }
+
+Tracer* TraceContext::GetTracerInternal() { return tracers_.back(); }
+
+
} // namespace remoting
DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger);
« 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