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

Side by Side Diff: sandbox/mac/xpc_message_server.cc

Issue 1556133002: Shutdown the sandbox MessageServer before deleting it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « sandbox/mac/xpc_message_server.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sandbox/mac/xpc_message_server.h" 5 #include "sandbox/mac/xpc_message_server.h"
6 6
7 #include <bsm/libbsm.h> 7 #include <bsm/libbsm.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 std::string label = base::StringPrintf( 42 std::string label = base::StringPrintf(
43 "org.chromium.sandbox.XPCMessageServer.%p", demuxer_); 43 "org.chromium.sandbox.XPCMessageServer.%p", demuxer_);
44 dispatch_source_.reset(new base::DispatchSourceMach( 44 dispatch_source_.reset(new base::DispatchSourceMach(
45 label.c_str(), server_port_.get(), ^{ ReceiveMessage(); })); 45 label.c_str(), server_port_.get(), ^{ ReceiveMessage(); }));
46 dispatch_source_->Resume(); 46 dispatch_source_->Resume();
47 47
48 return true; 48 return true;
49 } 49 }
50 50
51 void XPCMessageServer::Shutdown() {
52 dispatch_source_.reset();
53 }
54
51 pid_t XPCMessageServer::GetMessageSenderPID(IPCMessage request) { 55 pid_t XPCMessageServer::GetMessageSenderPID(IPCMessage request) {
52 audit_token_t token; 56 audit_token_t token;
53 xpc_dictionary_get_audit_token(request.xpc, &token); 57 xpc_dictionary_get_audit_token(request.xpc, &token);
54 // TODO(rsesek): In the 10.7 SDK, there's audit_token_to_pid(). 58 // TODO(rsesek): In the 10.7 SDK, there's audit_token_to_pid().
55 pid_t sender_pid; 59 pid_t sender_pid;
56 audit_token_to_au32(token, 60 audit_token_to_au32(token,
57 NULL, NULL, NULL, NULL, NULL, &sender_pid, NULL, NULL); 61 NULL, NULL, NULL, NULL, NULL, &sender_pid, NULL, NULL);
58 return sender_pid; 62 return sender_pid;
59 } 63 }
60 64
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 demuxer_->DemuxMessage(request); 117 demuxer_->DemuxMessage(request);
114 118
115 xpc_release(request.xpc); 119 xpc_release(request.xpc);
116 if (reply_message_) { 120 if (reply_message_) {
117 xpc_release(reply_message_); 121 xpc_release(reply_message_);
118 reply_message_ = NULL; 122 reply_message_ = NULL;
119 } 123 }
120 } 124 }
121 125
122 } // namespace sandbox 126 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/mac/xpc_message_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698