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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_argument.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) 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/trace_event/trace_event_impl.h" 5 #include "base/trace_event/trace_event_impl.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 20 matching lines...) Expand all
31 if (written <= 0) 31 if (written <= 0)
32 break; 32 break;
33 total_written += written; 33 total_written += written;
34 } 34 }
35 if (total_written < size) { 35 if (total_written < size) {
36 PLOG(WARNING) << "Failed to write buffer '" << std::string(buffer, size) 36 PLOG(WARNING) << "Failed to write buffer '" << std::string(buffer, size)
37 << "' to " << kATraceMarkerFile; 37 << "' to " << kATraceMarkerFile;
38 } 38 }
39 } 39 }
40 40
41 void WriteEvent(char phase, 41 void WriteEvent(
42 const char* category_group, 42 char phase,
43 const char* name, 43 const char* category_group,
44 unsigned long long id, 44 const char* name,
45 const char** arg_names, 45 unsigned long long id,
46 const unsigned char* arg_types, 46 const char** arg_names,
47 const TraceEvent::TraceValue* arg_values, 47 const unsigned char* arg_types,
48 const scoped_ptr<ConvertableToTraceFormat>* convertable_values, 48 const TraceEvent::TraceValue* arg_values,
49 unsigned int flags) { 49 const std::unique_ptr<ConvertableToTraceFormat>* convertable_values,
50 unsigned int flags) {
50 std::string out = StringPrintf("%c|%d|%s", phase, getpid(), name); 51 std::string out = StringPrintf("%c|%d|%s", phase, getpid(), name);
51 if (flags & TRACE_EVENT_FLAG_HAS_ID) 52 if (flags & TRACE_EVENT_FLAG_HAS_ID)
52 StringAppendF(&out, "-%" PRIx64, static_cast<uint64_t>(id)); 53 StringAppendF(&out, "-%" PRIx64, static_cast<uint64_t>(id));
53 out += '|'; 54 out += '|';
54 55
55 for (int i = 0; i < kTraceMaxNumArgs && arg_names[i]; 56 for (int i = 0; i < kTraceMaxNumArgs && arg_names[i];
56 ++i) { 57 ++i) {
57 if (i) 58 if (i)
58 out += ';'; 59 out += ';';
59 out += arg_names[i]; 60 out += arg_names[i];
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // trace buffer. 205 // trace buffer.
205 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF(); 206 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF();
206 std::string marker = StringPrintf( 207 std::string marker = StringPrintf(
207 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); 208 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
208 WriteToATrace(atrace_fd, marker.c_str(), marker.size()); 209 WriteToATrace(atrace_fd, marker.c_str(), marker.size());
209 close(atrace_fd); 210 close(atrace_fd);
210 } 211 }
211 212
212 } // namespace trace_event 213 } // namespace trace_event
213 } // namespace base 214 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_argument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698