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

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

Issue 2041033003: clang-tidy WaitableEvent refactor (Android side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0_windows
Patch Set: Created 4 years, 6 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
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void TraceLog::StopATrace() { 121 void TraceLog::StopATrace() {
122 if (g_atrace_fd == -1) 122 if (g_atrace_fd == -1)
123 return; 123 return;
124 124
125 close(g_atrace_fd); 125 close(g_atrace_fd);
126 g_atrace_fd = -1; 126 g_atrace_fd = -1;
127 127
128 // TraceLog::Flush() requires the current thread to have a message loop, but 128 // TraceLog::Flush() requires the current thread to have a message loop, but
129 // this thread called from Java may not have one, so flush in another thread. 129 // this thread called from Java may not have one, so flush in another thread.
130 Thread end_chrome_tracing_thread("end_chrome_tracing"); 130 Thread end_chrome_tracing_thread("end_chrome_tracing");
131 WaitableEvent complete_event(false, false); 131 WaitableEvent complete_event(WaitableEvent::ResetPolicy::AUTOMATIC,
132 WaitableEvent::InitialState::NOT_SIGNALED);
132 end_chrome_tracing_thread.Start(); 133 end_chrome_tracing_thread.Start();
133 end_chrome_tracing_thread.task_runner()->PostTask( 134 end_chrome_tracing_thread.task_runner()->PostTask(
134 FROM_HERE, base::Bind(&EndChromeTracing, Unretained(this), 135 FROM_HERE, base::Bind(&EndChromeTracing, Unretained(this),
135 Unretained(&complete_event))); 136 Unretained(&complete_event)));
136 complete_event.Wait(); 137 complete_event.Wait();
137 } 138 }
138 139
139 void TraceEvent::SendToATrace() { 140 void TraceEvent::SendToATrace() {
140 if (g_atrace_fd == -1) 141 if (g_atrace_fd == -1)
141 return; 142 return;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // trace buffer. 206 // trace buffer.
206 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF(); 207 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF();
207 std::string marker = StringPrintf( 208 std::string marker = StringPrintf(
208 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); 209 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
209 WriteToATrace(atrace_fd, marker.c_str(), marker.size()); 210 WriteToATrace(atrace_fd, marker.c_str(), marker.size());
210 close(atrace_fd); 211 close(atrace_fd);
211 } 212 }
212 213
213 } // namespace trace_event 214 } // namespace trace_event
214 } // namespace base 215 } // namespace base
OLDNEW
« no previous file with comments | « base/test/test_support_android.cc ('k') | blimp/client/feature/compositor/blimp_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698