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

Unified Diff: chrome/common/service_process_util_posix.cc

Issue 6825063: Patch for bug 74983 (among others) to be applied to M11 696 branch. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/696/src
Patch Set: intentionally disabled mac tests. tested by hand. Created 9 years, 8 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 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 189fd7f27fd298da4ddd1dd1dae42e829c151735..4bb3a3d1a7d93e6193f8dd09cdfe5be2879d13ca 100644
--- a/chrome/common/service_process_util_posix.cc
+++ b/chrome/common/service_process_util_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -55,6 +55,7 @@ static void SigTermHandler(int sig, siginfo_t* info, void* uap) {
ServiceProcessState::StateData::StateData() {}
void ServiceProcessState::StateData::SignalReady() {
+ CHECK_EQ(g_signal_socket, -1);
CHECK(MessageLoopForIO::current()->WatchFileDescriptor(
sockets_[0], true, MessageLoopForIO::WATCH_READ,
&watcher_, shut_down_monitor_.get()));
@@ -94,8 +95,7 @@ bool ServiceProcessState::InitializeState() {
bool ServiceProcessState::SignalReady(
base::MessageLoopProxy* message_loop_proxy, Task* shutdown_task) {
CHECK(state_);
- CHECK_EQ(g_signal_socket, -1);
-
+ scoped_ptr<Task> scoped_shutdown_task(shutdown_task);
#if defined(OS_LINUX)
state_->running_lock_.reset(TakeServiceRunningLock(true));
if (state_->running_lock_.get() == NULL) {
@@ -103,18 +103,23 @@ bool ServiceProcessState::SignalReady(
}
#endif // OS_LINUX
state_->shut_down_monitor_.reset(
- new ServiceProcessShutdownMonitor(shutdown_task));
+ new ServiceProcessShutdownMonitor(scoped_shutdown_task.release()));
if (pipe(state_->sockets_) < 0) {
PLOG(ERROR) << "pipe";
return false;
}
+#if defined(OS_MACOSX)
+ state_->state_ = this;
+ message_loop_proxy->PostTask(FROM_HERE,
+ NewRunnableMethod(state_,
+ &ServiceProcessState::StateData::WatchExecutable));
+#endif // OS_MACOSX
message_loop_proxy->PostTask(FROM_HERE,
NewRunnableMethod(state_, &ServiceProcessState::StateData::SignalReady));
return true;
}
void ServiceProcessState::TearDownState() {
- g_signal_socket = -1;
if (state_) {
if (state_->sockets_[0] != -1) {
close(state_->sockets_[0]);
@@ -127,6 +132,7 @@ void ServiceProcessState::TearDownState() {
PLOG(ERROR) << "sigaction";
}
}
+ g_signal_socket = -1;
state_->Release();
state_ = NULL;
}
« 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