Skip to content

Commit

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


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126055 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tedvessenes@gmail.com committed Mar 11, 2012
1 parent 21658d8 commit 4b45426
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions dbus/bus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Timeout : public base::RefCountedThreadSafe<Timeout> {
bus->PostDelayedTaskToDBusThread(FROM_HERE,
base::Bind(&Timeout::HandleTimeout,
this),
GetIntervalInMs());
GetInterval());
monitoring_is_active_ = true;
}

Expand All @@ -128,9 +128,10 @@ class Timeout : public base::RefCountedThreadSafe<Timeout> {
monitoring_is_active_ = false;
}

// Returns the interval in milliseconds.
int GetIntervalInMs() {
return dbus_timeout_get_interval(raw_timeout_);
// Returns the interval.
base::TimeDelta GetInterval() {
return base::TimeDelta::FromMilliseconds(
dbus_timeout_get_interval(raw_timeout_));
}

// Cleans up the raw_timeout and marks that timeout is completed.
Expand Down Expand Up @@ -642,16 +643,16 @@ void Bus::PostTaskToDBusThread(const tracked_objects::Location& from_here,
void Bus::PostDelayedTaskToDBusThread(
const tracked_objects::Location& from_here,
const base::Closure& task,
int delay_ms) {
base::TimeDelta delay) {
if (dbus_thread_message_loop_proxy_.get()) {
if (!dbus_thread_message_loop_proxy_->PostDelayedTask(
from_here, task, delay_ms)) {
from_here, task, delay)) {
LOG(WARNING) << "Failed to post a task to the D-Bus thread message loop";
}
} else {
DCHECK(origin_message_loop_proxy_.get());
if (!origin_message_loop_proxy_->PostDelayedTask(
from_here, task, delay_ms)) {
from_here, task, delay)) {
LOG(WARNING) << "Failed to post a task to the origin message loop";
}
}
Expand Down
2 changes: 1 addition & 1 deletion dbus/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class Bus : public base::RefCountedThreadSafe<Bus> {
virtual void PostDelayedTaskToDBusThread(
const tracked_objects::Location& from_here,
const base::Closure& task,
int delay_ms);
base::TimeDelta delay);

// Returns true if the bus has the D-Bus thread.
virtual bool HasDBusThread();
Expand Down
2 changes: 1 addition & 1 deletion dbus/end_to_end_async_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ TEST_F(EndToEndAsyncTest, EmptyResponseCallback) {
// Post a delayed task to quit the message loop.
message_loop_.PostDelayedTask(FROM_HERE,
MessageLoop::QuitClosure(),
TestTimeouts::tiny_timeout_ms());
TestTimeouts::tiny_timeout());
message_loop_.Run();
// We cannot tell if the empty callback is called, but at least we can
// check if the test does not crash.
Expand Down
2 changes: 1 addition & 1 deletion dbus/mock_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class MockBus : public Bus {
MOCK_METHOD3(PostDelayedTaskToDBusThread, void(
const tracked_objects::Location& from_here,
const base::Closure& task,
int delay_ms));
base::TimeDelta delay));
MOCK_METHOD0(HasDBusThread, bool());
MOCK_METHOD0(AssertOnOriginThread, void());
MOCK_METHOD0(AssertOnDBusThread, void());
Expand Down
2 changes: 1 addition & 1 deletion dbus/test_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void TestService::AsyncEcho(
base::Unretained(this),
method_call,
response_sender),
TestTimeouts::tiny_timeout_ms());
TestTimeouts::tiny_timeout());
}

void TestService::BrokenMethod(
Expand Down

0 comments on commit 4b45426

Please sign in to comment.