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

Side by Side Diff: chrome/common/service_process_util_posix.cc

Issue 6660001: Getting service process on Mac to handle having things moved/changed underneath it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move over to FilePathWatcher Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/common/service_process_util_posix.h" 5 #include "chrome/common/service_process_util_posix.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 9
10 namespace { 10 namespace {
11 int g_signal_socket = -1; 11 int g_signal_socket = -1;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (state_->running_lock_.get() == NULL) { 101 if (state_->running_lock_.get() == NULL) {
102 return false; 102 return false;
103 } 103 }
104 #endif // OS_LINUX 104 #endif // OS_LINUX
105 state_->shut_down_monitor_.reset( 105 state_->shut_down_monitor_.reset(
106 new ServiceProcessShutdownMonitor(shutdown_task)); 106 new ServiceProcessShutdownMonitor(shutdown_task));
107 if (pipe(state_->sockets_) < 0) { 107 if (pipe(state_->sockets_) < 0) {
108 PLOG(ERROR) << "pipe"; 108 PLOG(ERROR) << "pipe";
109 return false; 109 return false;
110 } 110 }
111 #if defined(OS_MACOSX)
112 state_->state_ = this;
113 message_loop_proxy->PostTask(FROM_HERE,
114 NewRunnableMethod(state_,
115 &ServiceProcessState::StateData::WatchExecutable,
116 shutdown_task));
117 #endif // OS_MACOSX
111 message_loop_proxy->PostTask(FROM_HERE, 118 message_loop_proxy->PostTask(FROM_HERE,
112 NewRunnableMethod(state_, &ServiceProcessState::StateData::SignalReady)); 119 NewRunnableMethod(state_, &ServiceProcessState::StateData::SignalReady));
113 return true; 120 return true;
114 } 121 }
115 122
116 void ServiceProcessState::TearDownState() { 123 void ServiceProcessState::TearDownState() {
117 g_signal_socket = -1; 124 g_signal_socket = -1;
118 if (state_) { 125 if (state_) {
119 if (state_->sockets_[0] != -1) { 126 if (state_->sockets_[0] != -1) {
120 close(state_->sockets_[0]); 127 close(state_->sockets_[0]);
121 } 128 }
122 if (state_->sockets_[1] != -1) { 129 if (state_->sockets_[1] != -1) {
123 close(state_->sockets_[1]); 130 close(state_->sockets_[1]);
124 } 131 }
125 if (state_->set_action_) { 132 if (state_->set_action_) {
126 if (sigaction(SIGTERM, &state_->old_action_, NULL) < 0) { 133 if (sigaction(SIGTERM, &state_->old_action_, NULL) < 0) {
127 PLOG(ERROR) << "sigaction"; 134 PLOG(ERROR) << "sigaction";
128 } 135 }
129 } 136 }
130 state_->Release(); 137 state_->Release();
131 state_ = NULL; 138 state_ = NULL;
132 } 139 }
133 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698