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

Side by Side Diff: content/browser/tracing/background_tracing_rule.cc

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: . Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "content/browser/tracing/background_tracing_rule.h" 4 #include "content/browser/tracing/background_tracing_rule.h"
5 5
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/metrics/statistics_recorder.h" 10 #include "base/metrics/statistics_recorder.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 std::string GenerateUniqueName() const { 256 std::string GenerateUniqueName() const {
257 static int ids = 0; 257 static int ids = 0;
258 char work_buffer[256]; 258 char work_buffer[256];
259 base::strings::SafeSNPrintf(work_buffer, sizeof(work_buffer), "%s_%d", 259 base::strings::SafeSNPrintf(work_buffer, sizeof(work_buffer), "%s_%d",
260 kTraceAtRandomIntervalsEventName, ids++); 260 kTraceAtRandomIntervalsEventName, ids++);
261 return work_buffer; 261 return work_buffer;
262 } 262 }
263 263
264 private: 264 private:
265 std::string named_event_; 265 std::string named_event_;
266 base::OneShotTimer<ReactiveTraceAtRandomIntervalsRule> trigger_timer_; 266 base::OneShotTimer trigger_timer_;
267 BackgroundTracingConfigImpl::CategoryPreset category_preset_; 267 BackgroundTracingConfigImpl::CategoryPreset category_preset_;
268 BackgroundTracingManagerImpl::TriggerHandle handle_; 268 BackgroundTracingManagerImpl::TriggerHandle handle_;
269 int timeout_min_; 269 int timeout_min_;
270 int timeout_max_; 270 int timeout_max_;
271 }; 271 };
272 272
273 } // namespace 273 } // namespace
274 274
275 int BackgroundTracingRule::GetReactiveTimeout() const { 275 int BackgroundTracingRule::GetReactiveTimeout() const {
276 return -1; 276 return -1;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 return scoped_ptr<BackgroundTracingRule>( 343 return scoped_ptr<BackgroundTracingRule>(
344 new ReactiveTraceAtRandomIntervalsRule(category_preset, timeout_min, 344 new ReactiveTraceAtRandomIntervalsRule(category_preset, timeout_min,
345 timeout_max)); 345 timeout_max));
346 } 346 }
347 347
348 return nullptr; 348 return nullptr;
349 } 349 }
350 350
351 } // namespace content 351 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698