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

Unified Diff: base/debug/trace_event_impl.cc

Issue 568073003: Use weak_ptr in bind call to TraceLog::OnFlushTimeout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « base/debug/trace_event_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_impl.cc
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc
index db321e2bfa42c893e34acce70c37d802459c0e6f..1819d1a6dd3cbd8d7ad95651493a5fc16d99d5a1 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -1212,7 +1212,8 @@ TraceLog::TraceLog()
event_callback_category_filter_(
CategoryFilter::kDefaultCategoryFilterString),
thread_shared_chunk_index_(0),
- generation_(0) {
+ generation_(0),
+ weak_ptr_factory_(this) {
// Trace is enabled or disabled on one thread while other threads are
// accessing the enabled flag. We don't care whether edge-case events are
// traced or not, so we allow races on the enabled flag to keep the trace
@@ -1729,7 +1730,9 @@ void TraceLog::Flush(const TraceLog::OutputCallback& cb) {
}
flush_message_loop_proxy_->PostDelayedTask(
mmenke 2014/09/12 17:47:46 The weak pointer factory can only vend weak points
FROM_HERE,
- Bind(&TraceLog::OnFlushTimeout, Unretained(this), generation),
+ Bind(&TraceLog::OnFlushTimeout,
+ weak_ptr_factory_.GetWeakPtr(),
+ generation),
TimeDelta::FromMilliseconds(kThreadFlushTimeoutMs));
return;
}
« no previous file with comments | « base/debug/trace_event_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698