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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 1414503009: IPC: Remove unnecessary conversions of BrokerableAttachment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
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. 106 // both Send() and ProcessMessageForDelivery() may be re-entrant.
107 if (message->HasBrokerableAttachments()) { 107 if (message->HasBrokerableAttachments()) {
108 DCHECK(GetAttachmentBroker()); 108 DCHECK(GetAttachmentBroker());
109 DCHECK(peer_pid_ != base::kNullProcessId); 109 DCHECK(peer_pid_ != base::kNullProcessId);
110 for (BrokerableAttachment* attachment : 110 for (const scoped_refptr<IPC::BrokerableAttachment>& attachment :
111 message->attachment_set()->GetBrokerableAttachments()) { 111 message->attachment_set()->GetBrokerableAttachments()) {
112 if (!GetAttachmentBroker()->SendAttachmentToProcess(attachment, 112 if (!GetAttachmentBroker()->SendAttachmentToProcess(attachment,
113 peer_pid_)) { 113 peer_pid_)) {
114 delete message; 114 delete message;
115 return false; 115 return false;
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 #ifdef IPC_MESSAGE_LOG_ENABLED 120 #ifdef IPC_MESSAGE_LOG_ENABLED
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 int secret; 602 int secret;
603 do { // Guarantee we get a non-zero value. 603 do { // Guarantee we get a non-zero value.
604 secret = base::RandInt(0, std::numeric_limits<int>::max()); 604 secret = base::RandInt(0, std::numeric_limits<int>::max());
605 } while (secret == 0); 605 } while (secret == 0);
606 606
607 id.append(GenerateUniqueRandomChannelID()); 607 id.append(GenerateUniqueRandomChannelID());
608 return id.append(base::StringPrintf("\\%d", secret)); 608 return id.append(base::StringPrintf("\\%d", secret));
609 } 609 }
610 610
611 } // namespace IPC 611 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698