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

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

Issue 2695593009: Use the location where FileDescriptorWatcher is created to track the libevent handlers (Closed)
Patch Set: fix mac. Created 3 years, 10 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
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_exo.cc ('k') | chromeos/binder/ipc_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // not, but we don't ever expect it to be called. 73 // not, but we don't ever expect it to be called.
74 static void SigTermHandler(int sig, siginfo_t* info, void* uap) { 74 static void SigTermHandler(int sig, siginfo_t* info, void* uap) {
75 // TODO(dmaclach): add security here to make sure that we are being shut 75 // TODO(dmaclach): add security here to make sure that we are being shut
76 // down by an appropriate process. 76 // down by an appropriate process.
77 int message = ServiceProcessTerminateMonitor::kTerminateMessage; 77 int message = ServiceProcessTerminateMonitor::kTerminateMessage;
78 if (write(g_signal_socket, &message, sizeof(message)) < 0) { 78 if (write(g_signal_socket, &message, sizeof(message)) < 0) {
79 DPLOG(ERROR) << "write"; 79 DPLOG(ERROR) << "write";
80 } 80 }
81 } 81 }
82 82
83 ServiceProcessState::StateData::StateData() : set_action(false) { 83 ServiceProcessState::StateData::StateData()
84 : watcher(FROM_HERE), set_action(false) {
84 memset(sockets, -1, sizeof(sockets)); 85 memset(sockets, -1, sizeof(sockets));
85 memset(&old_action, 0, sizeof(old_action)); 86 memset(&old_action, 0, sizeof(old_action));
86 } 87 }
87 88
88 void ServiceProcessState::StateData::SignalReady(base::WaitableEvent* signal, 89 void ServiceProcessState::StateData::SignalReady(base::WaitableEvent* signal,
89 bool* success) { 90 bool* success) {
90 DCHECK(task_runner->BelongsToCurrentThread()); 91 DCHECK(task_runner->BelongsToCurrentThread());
91 DCHECK_EQ(g_signal_socket, -1); 92 DCHECK_EQ(g_signal_socket, -1);
92 DCHECK(!signal->IsSignaled()); 93 DCHECK(!signal->IsSignaled());
93 *success = base::MessageLoopForIO::current()->WatchFileDescriptor( 94 *success = base::MessageLoopForIO::current()->WatchFileDescriptor(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return success; 196 return success;
196 } 197 }
197 198
198 void ServiceProcessState::TearDownState() { 199 void ServiceProcessState::TearDownState() {
199 if (state_ && state_->task_runner) 200 if (state_ && state_->task_runner)
200 state_->task_runner->DeleteSoon(FROM_HERE, state_); 201 state_->task_runner->DeleteSoon(FROM_HERE, state_);
201 else 202 else
202 delete state_; 203 delete state_;
203 state_ = nullptr; 204 state_ = nullptr;
204 } 205 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_exo.cc ('k') | chromeos/binder/ipc_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698