Skip to content

Commit

Permalink
Convert uses of int ms to TimeDelta in jingle and remoting.
Browse files Browse the repository at this point in the history
R=sergeyu@chromium.org
BUG=108171


Review URL: http://codereview.chromium.org/9572038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124915 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tedvessenes@gmail.com committed Mar 5, 2012
1 parent 4557d22 commit 1e2076b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions jingle/glue/pseudotcp_adapter_unittest.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -141,7 +141,7 @@ class FakeSocket : public net::Socket {
base::Bind(&FakeSocket::AppendInputPacket,
base::Unretained(peer_socket_),
std::vector<char>(buf->data(), buf->data() + buf_len)),
latency_ms_);
base::TimeDelta::FromMilliseconds(latency_ms_));
}

return buf_len;
Expand Down
12 changes: 7 additions & 5 deletions jingle/glue/thread_wrapper_unittest.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -147,8 +147,9 @@ TEST_F(ThreadWrapperTest, PostDelayed) {
MatchMessage(&handler2_, kTestMessage1, data4)))
.WillOnce(DeleteMessageData());

message_loop_.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(),
kMaxTestDelay);
message_loop_.PostDelayedTask(
FROM_HERE, MessageLoop::QuitClosure(),
base::TimeDelta::FromMilliseconds(kMaxTestDelay));
message_loop_.Run();
}

Expand Down Expand Up @@ -197,8 +198,9 @@ TEST_F(ThreadWrapperTest, ClearDelayed) {
MatchMessage(&handler2_, kTestMessage1, null_data)))
.WillOnce(DeleteMessageData());

message_loop_.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(),
kMaxTestDelay);
message_loop_.PostDelayedTask(
FROM_HERE, MessageLoop::QuitClosure(),
base::TimeDelta::FromMilliseconds(kMaxTestDelay));
message_loop_.Run();
}

Expand Down
4 changes: 2 additions & 2 deletions remoting/client/plugin/chromoting_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void ChromotingInstance::Connect(const ClientConfig& config) {
// Start timer that periodically sends perf stats.
plugin_message_loop_->PostDelayedTask(
FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, AsWeakPtr()),
kPerfStatsIntervalMs);
base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs));

VLOG(1) << "Connection status: Initializing";
SetConnectionState(STATE_INITIALIZING, ERROR_NONE);
Expand Down Expand Up @@ -431,7 +431,7 @@ void ChromotingInstance::SendPerfStats() {

plugin_message_loop_->PostDelayedTask(
FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, AsWeakPtr()),
kPerfStatsIntervalMs);
base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs));

scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
ChromotingStats* stats = client_->GetStats();
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/policy_hack/nat_policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void NatPolicy::ScheduleReloadTask(const base::TimeDelta& delay) {
message_loop_proxy_->PostDelayedTask(
FROM_HERE,
base::Bind(&NatPolicy::Reload, weak_factory_.GetWeakPtr()),
delay.InMilliseconds());
delay);
}

bool NatPolicy::OnPolicyThread() const {
Expand Down
2 changes: 1 addition & 1 deletion remoting/jingle_glue/iq_sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ IqRequest::~IqRequest() {
void IqRequest::SetTimeout(base::TimeDelta timeout) {
base::MessageLoopProxy::current()->PostDelayedTask(
FROM_HERE, base::Bind(&IqRequest::OnTimeout, AsWeakPtr()),
timeout.InMilliseconds());
timeout);
}

void IqRequest::CallCallback(const buzz::XmlElement* stanza) {
Expand Down
4 changes: 2 additions & 2 deletions remoting/jingle_glue/jingle_thread_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TEST(JingleThreadTest, PostDelayedTask) {
base::Time start = base::Time::Now();
thread.message_loop()->PostDelayedTask(
FROM_HERE, base::Bind(&MockCallback::Run, base::Unretained(&task)),
kDelayMs);
base::TimeDelta::FromMilliseconds(kDelayMs));
event.TimedWait(base::TimeDelta::FromMilliseconds(kDelayTimeoutMs));
base::Time end = base::Time::Now();
thread.Stop();
Expand All @@ -81,7 +81,7 @@ TEST(JingleThreadTest, PostNonNestableDelayedTask) {
base::Time start = base::Time::Now();
thread.message_loop()->PostNonNestableDelayedTask(
FROM_HERE, base::Bind(&MockCallback::Run, base::Unretained(&task)),
kDelayMs);
base::TimeDelta::FromMilliseconds(kDelayMs));
event.TimedWait(base::TimeDelta::FromMilliseconds(kDelayTimeoutMs));
base::Time end = base::Time::Now();
thread.Stop();
Expand Down
8 changes: 5 additions & 3 deletions remoting/protocol/connection_tester.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -203,8 +203,10 @@ void DatagramConnectionTester::HandleWriteResult(int result) {
} else if (result > 0) {
EXPECT_EQ(message_size_, result);
packets_sent_++;
message_loop_->PostDelayedTask(FROM_HERE, base::Bind(
&DatagramConnectionTester::DoWrite, base::Unretained(this)), delay_ms_);
message_loop_->PostDelayedTask(
FROM_HERE,
base::Bind(&DatagramConnectionTester::DoWrite, base::Unretained(this)),
base::TimeDelta::FromMilliseconds(delay_ms_));
}
}

Expand Down

0 comments on commit 1e2076b

Please sign in to comment.