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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 1385143002: ipc: Update MachPortMac ownership semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase errors. Created 5 years, 2 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 | « ipc/ipc_channel_reader_unittest.cc ('k') | ipc/ipc_message.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 "ipc/ipc_channel_win.h" 5 #include "ipc/ipc_channel_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return ProcessMessageForDelivery(message); 101 return ProcessMessageForDelivery(message);
102 } 102 }
103 103
104 bool ChannelWin::ProcessMessageForDelivery(Message* message) { 104 bool ChannelWin::ProcessMessageForDelivery(Message* message) {
105 // Sending a brokerable attachment requires a call to Channel::Send(), so 105 // Sending a brokerable attachment requires a call to Channel::Send(), so
106 // both Send() and ProcessMessageForDelivery() may be re-entrant. Brokered 106 // both Send() and ProcessMessageForDelivery() may be re-entrant. Brokered
107 // attachments must be sent before the Message itself. 107 // attachments must be sent before the Message itself.
108 if (message->HasBrokerableAttachments()) { 108 if (message->HasBrokerableAttachments()) {
109 DCHECK(GetAttachmentBroker()); 109 DCHECK(GetAttachmentBroker());
110 DCHECK(peer_pid_ != base::kNullProcessId); 110 DCHECK(peer_pid_ != base::kNullProcessId);
111 for (const BrokerableAttachment* attachment : 111 for (BrokerableAttachment* attachment :
112 message->attachment_set()->PeekBrokerableAttachments()) { 112 message->attachment_set()->GetBrokerableAttachments()) {
113 if (!GetAttachmentBroker()->SendAttachmentToProcess(attachment, 113 if (!GetAttachmentBroker()->SendAttachmentToProcess(attachment,
114 peer_pid_)) { 114 peer_pid_)) {
115 delete message; 115 delete message;
116 return false; 116 return false;
117 } 117 }
118 } 118 }
119 } 119 }
120 120
121 #ifdef IPC_MESSAGE_LOG_ENABLED 121 #ifdef IPC_MESSAGE_LOG_ENABLED
122 Logging::GetInstance()->OnSendMessage(message, ""); 122 Logging::GetInstance()->OnSendMessage(message, "");
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 int secret; 603 int secret;
604 do { // Guarantee we get a non-zero value. 604 do { // Guarantee we get a non-zero value.
605 secret = base::RandInt(0, std::numeric_limits<int>::max()); 605 secret = base::RandInt(0, std::numeric_limits<int>::max());
606 } while (secret == 0); 606 } while (secret == 0);
607 607
608 id.append(GenerateUniqueRandomChannelID()); 608 id.append(GenerateUniqueRandomChannelID());
609 return id.append(base::StringPrintf("\\%d", secret)); 609 return id.append(base::StringPrintf("\\%d", secret));
610 } 610 }
611 611
612 } // namespace IPC 612 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_reader_unittest.cc ('k') | ipc/ipc_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698