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

Side by Side Diff: base/debug/trace_event_android.cc

Issue 425593002: Refactor trace_event_impl's SetEnabled to use TraceOptions. Propagate this through the whole stack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Nat and Dan's comments. Use CategoryFilter for tracing_controller.h's APIs Created 6 years, 4 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
« no previous file with comments | « no previous file | base/debug/trace_event_impl.h » ('j') | base/debug/trace_event_impl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/debug/trace_event_impl.h" 5 #include "base/debug/trace_event_impl.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (g_atrace_fd != -1) 91 if (g_atrace_fd != -1)
92 return; 92 return;
93 93
94 g_atrace_fd = open(kATraceMarkerFile, O_WRONLY); 94 g_atrace_fd = open(kATraceMarkerFile, O_WRONLY);
95 if (g_atrace_fd == -1) { 95 if (g_atrace_fd == -1) {
96 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile; 96 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile;
97 return; 97 return;
98 } 98 }
99 SetEnabled(CategoryFilter(CategoryFilter::kDefaultCategoryFilterString), 99 SetEnabled(CategoryFilter(CategoryFilter::kDefaultCategoryFilterString),
100 base::debug::TraceLog::RECORDING_MODE, 100 base::debug::TraceLog::RECORDING_MODE,
101 RECORD_CONTINUOUSLY); 101 base::debug::TraceOptions(
102 base::debug::RECORD_CONTINUOUSLY));
102 } 103 }
103 104
104 void TraceLog::StopATrace() { 105 void TraceLog::StopATrace() {
105 if (g_atrace_fd == -1) 106 if (g_atrace_fd == -1)
106 return; 107 return;
107 108
108 close(g_atrace_fd); 109 close(g_atrace_fd);
109 g_atrace_fd = -1; 110 g_atrace_fd = -1;
110 111
111 // TraceLog::Flush() requires the current thread to have a message loop, but 112 // TraceLog::Flush() requires the current thread to have a message loop, but
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 double now_in_seconds = now.ToInternalValue() / 1000000.0; 191 double now_in_seconds = now.ToInternalValue() / 1000000.0;
191 std::string marker = StringPrintf( 192 std::string marker = StringPrintf(
192 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); 193 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
193 if (write(atrace_fd, marker.c_str(), marker.size()) == -1) 194 if (write(atrace_fd, marker.c_str(), marker.size()) == -1)
194 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile; 195 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile;
195 close(atrace_fd); 196 close(atrace_fd);
196 } 197 }
197 198
198 } // namespace debug 199 } // namespace debug
199 } // namespace base 200 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event_impl.h » ('j') | base/debug/trace_event_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698