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

Unified Diff: chrome/common/service_process_util_posix.cc

Issue 8495039: NewRunnable* conversion to base::Bind for service process utils. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Could swear I build this on the Mac... Created 9 years, 1 month 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 | « chrome/common/service_process_util_posix.h ('k') | chrome/common/service_process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/service_process_util_posix.cc
diff --git a/chrome/common/service_process_util_posix.cc b/chrome/common/service_process_util_posix.cc
index 41780f8d370bfd3569597a6c158ad95c76a7c65b..95c92fbb5cdda51c05a35d5dc14542f1100105be 100644
--- a/chrome/common/service_process_util_posix.cc
+++ b/chrome/common/service_process_util_posix.cc
@@ -5,6 +5,7 @@
#include "chrome/common/service_process_util_posix.h"
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/eintr_wrapper.h"
#include "base/message_loop_proxy.h"
#include "base/synchronization/waitable_event.h"
@@ -14,7 +15,7 @@ int g_signal_socket = -1;
}
ServiceProcessTerminateMonitor::ServiceProcessTerminateMonitor(
- Task* terminate_task)
+ const base::Closure& terminate_task)
: terminate_task_(terminate_task) {
}
@@ -22,12 +23,12 @@ ServiceProcessTerminateMonitor::~ServiceProcessTerminateMonitor() {
}
void ServiceProcessTerminateMonitor::OnFileCanReadWithoutBlocking(int fd) {
- if (terminate_task_.get()) {
+ if (!terminate_task_.is_null()) {
int buffer;
int length = read(fd, &buffer, sizeof(buffer));
if ((length == sizeof(buffer)) && (buffer == kTerminateMessage)) {
- terminate_task_->Run();
- terminate_task_.reset();
+ terminate_task_.Run();
+ terminate_task_.Reset();
} else if (length > 0) {
DLOG(ERROR) << "Unexpected read: " << buffer;
} else if (length == 0) {
@@ -136,10 +137,10 @@ void ServiceProcessState::CreateState() {
}
bool ServiceProcessState::SignalReady(
- base::MessageLoopProxy* message_loop_proxy, Task* terminate_task) {
+ base::MessageLoopProxy* message_loop_proxy,
+ const base::Closure& terminate_task) {
DCHECK(state_);
- scoped_ptr<Task> scoped_terminate_task(terminate_task);
#if defined(OS_POSIX) && !defined(OS_MACOSX)
state_->running_lock_.reset(TakeServiceRunningLock(true));
if (state_->running_lock_.get() == NULL) {
@@ -147,7 +148,7 @@ bool ServiceProcessState::SignalReady(
}
#endif
state_->terminate_monitor_.reset(
- new ServiceProcessTerminateMonitor(scoped_terminate_task.release()));
+ new ServiceProcessTerminateMonitor(terminate_task));
if (pipe(state_->sockets_) < 0) {
DPLOG(ERROR) << "pipe";
return false;
@@ -156,9 +157,10 @@ bool ServiceProcessState::SignalReady(
bool success = false;
message_loop_proxy->PostTask(FROM_HERE,
- NewRunnableMethod(state_, &ServiceProcessState::StateData::SignalReady,
- &signal_ready,
- &success));
+ base::Bind(&ServiceProcessState::StateData::SignalReady,
+ state_,
+ &signal_ready,
+ &success));
signal_ready.Wait();
return success;
}
« no previous file with comments | « chrome/common/service_process_util_posix.h ('k') | chrome/common/service_process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698