summaryrefslogtreecommitdiffstats
path: root/base/debug/trace_event.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/debug/trace_event.cc')
-rw-r--r--base/debug/trace_event.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
new file mode 100644
index 0000000..682e065
--- /dev/null
+++ b/base/debug/trace_event.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/debug/trace_event.h"
+
+namespace trace_event_internal {
+
+void TraceEndOnScopeClose::Initialize(const unsigned char* category_enabled,
+ const char* name) {
+ data_.category_enabled = category_enabled;
+ data_.name = name;
+ p_data_ = &data_;
+}
+
+void TraceEndOnScopeClose::AddEventIfEnabled() {
+ // Only called when p_data_ is non-null.
+ if (*p_data_->category_enabled) {
+ TRACE_EVENT_API_ADD_TRACE_EVENT(
+ TRACE_EVENT_PHASE_END,
+ p_data_->category_enabled,
+ p_data_->name, kNoEventId,
+ kZeroNumArgs, NULL, NULL, NULL,
+ TRACE_EVENT_FLAG_NONE);
+ }
+}
+
+} // namespace trace_event_internal