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

Side by Side Diff: content/browser/trace_controller.cc

Issue 9572035: Convert uses of int ms to TimeDelta in content/browser, ipc, and webkit/plugins. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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 "content/browser/trace_controller.h" 5 #include "content/browser/trace_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 std::string delay_str = command_line.GetSwitchValueASCII( 90 std::string delay_str = command_line.GetSwitchValueASCII(
91 switches::kTraceStartupDuration); 91 switches::kTraceStartupDuration);
92 int delay_secs = 5; 92 int delay_secs = 5;
93 if (!delay_str.empty() && !base::StringToInt(delay_str, &delay_secs)) { 93 if (!delay_str.empty() && !base::StringToInt(delay_str, &delay_secs)) {
94 DLOG(WARNING) << "Could not parse --" << switches::kTraceStartupDuration 94 DLOG(WARNING) << "Could not parse --" << switches::kTraceStartupDuration
95 << "=" << delay_str << " defaulting to 5 (secs)"; 95 << "=" << delay_str << " defaulting to 5 (secs)";
96 delay_secs = 5; 96 delay_secs = 5;
97 } 97 }
98 98
99 OnTracingBegan(subscriber.get()); 99 OnTracingBegan(subscriber.get());
100 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, 100 BrowserThread::PostDelayedTask(
101 BrowserThread::UI,
102 FROM_HERE,
101 base::Bind(&AutoStopTraceSubscriberStdio::EndStartupTrace, 103 base::Bind(&AutoStopTraceSubscriberStdio::EndStartupTrace,
102 base::Unretained(subscriber.release())), 104 base::Unretained(subscriber.release())),
103 delay_secs * 1000); 105 base::TimeDelta::FromSeconds(delay_secs));
104 } 106 }
105 107
106 bool TraceController::GetKnownCategoriesAsync(TraceSubscriber* subscriber) { 108 bool TraceController::GetKnownCategoriesAsync(TraceSubscriber* subscriber) {
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
108 110
109 // Known categories come back from child processes with the EndTracingAck 111 // Known categories come back from child processes with the EndTracingAck
110 // message. So to get known categories, just begin and end tracing immediately 112 // message. So to get known categories, just begin and end tracing immediately
111 // afterwards. This will ping all the child processes for categories. 113 // afterwards. This will ping all the child processes for categories.
112 is_get_categories_ = true; 114 is_get_categories_ = true;
113 bool success = BeginTracing(subscriber) && EndTracingAsync(subscriber); 115 bool success = BeginTracing(subscriber) && EndTracingAsync(subscriber);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 if (pending_bpf_ack_count_ == 1) { 364 if (pending_bpf_ack_count_ == 1) {
363 // The last ack represents local trace, so we need to ack it now. Note that 365 // The last ack represents local trace, so we need to ack it now. Note that
364 // this code only executes if there were child processes. 366 // this code only executes if there were child processes.
365 float bpf = TraceLog::GetInstance()->GetBufferPercentFull(); 367 float bpf = TraceLog::GetInstance()->GetBufferPercentFull();
366 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 368 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
367 base::Bind(&TraceController::OnTraceBufferPercentFullReply, 369 base::Bind(&TraceController::OnTraceBufferPercentFullReply,
368 base::Unretained(this), bpf)); 370 base::Unretained(this), bpf));
369 } 371 }
370 } 372 }
371 373
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_unittest.cc ('k') | ipc/ipc_channel_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698