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

Side by Side Diff: ipc/ipc_channel_nacl.cc

Issue 1292263003: ipc: Use a global for the process's attachment broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_message2
Patch Set: Comments from avi. Created 5 years, 3 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_nacl.h ('k') | ipc/ipc_channel_posix.h » ('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_nacl.h" 5 #include "ipc/ipc_channel_nacl.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 ChannelNacl::ChannelNacl(const IPC::ChannelHandle& channel_handle, 124 ChannelNacl::ChannelNacl(const IPC::ChannelHandle& channel_handle,
125 Mode mode, 125 Mode mode,
126 Listener* listener, 126 Listener* listener,
127 AttachmentBroker* broker) 127 AttachmentBroker* broker)
128 : ChannelReader(listener), 128 : ChannelReader(listener),
129 mode_(mode), 129 mode_(mode),
130 waiting_connect_(true), 130 waiting_connect_(true),
131 pipe_(-1), 131 pipe_(-1),
132 pipe_name_(channel_handle.name), 132 pipe_name_(channel_handle.name),
133 weak_ptr_factory_(this), 133 weak_ptr_factory_(this) {
134 broker_(broker) {
135 if (!CreatePipe(channel_handle)) { 134 if (!CreatePipe(channel_handle)) {
136 // The pipe may have been closed already. 135 // The pipe may have been closed already.
137 const char *modestr = (mode_ & MODE_SERVER_FLAG) ? "server" : "client"; 136 const char *modestr = (mode_ & MODE_SERVER_FLAG) ? "server" : "client";
138 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name 137 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name
139 << "\" in " << modestr << " mode"; 138 << "\" in " << modestr << " mode";
140 } 139 }
141 } 140 }
142 141
143 ChannelNacl::~ChannelNacl() { 142 ChannelNacl::~ChannelNacl() {
144 CleanUp(); 143 CleanUp();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 message->header()->flags, 217 message->header()->flags,
219 TRACE_EVENT_FLAG_FLOW_OUT); 218 TRACE_EVENT_FLAG_FLOW_OUT);
220 output_queue_.push_back(linked_ptr<Message>(message_ptr.release())); 219 output_queue_.push_back(linked_ptr<Message>(message_ptr.release()));
221 if (!waiting_connect_) 220 if (!waiting_connect_)
222 return ProcessOutgoingMessages(); 221 return ProcessOutgoingMessages();
223 222
224 return true; 223 return true;
225 } 224 }
226 225
227 AttachmentBroker* ChannelNacl::GetAttachmentBroker() { 226 AttachmentBroker* ChannelNacl::GetAttachmentBroker() {
228 return broker_; 227 return nullptr;
229 } 228 }
230 229
231 void ChannelNacl::DidRecvMsg(scoped_ptr<MessageContents> contents) { 230 void ChannelNacl::DidRecvMsg(scoped_ptr<MessageContents> contents) {
232 // Close sets the pipe to -1. It's possible we'll get a buffer sent to us from 231 // Close sets the pipe to -1. It's possible we'll get a buffer sent to us from
233 // the reader thread after Close is called. If so, we ignore it. 232 // the reader thread after Close is called. If so, we ignore it.
234 if (pipe_ == -1) 233 if (pipe_ == -1)
235 return; 234 return;
236 235
237 linked_ptr<std::vector<char> > data(new std::vector<char>); 236 linked_ptr<std::vector<char> > data(new std::vector<char>);
238 data->swap(contents->data); 237 data->swap(contents->data);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 // static 398 // static
400 scoped_ptr<Channel> Channel::Create(const IPC::ChannelHandle& channel_handle, 399 scoped_ptr<Channel> Channel::Create(const IPC::ChannelHandle& channel_handle,
401 Mode mode, 400 Mode mode,
402 Listener* listener, 401 Listener* listener,
403 AttachmentBroker* broker) { 402 AttachmentBroker* broker) {
404 return scoped_ptr<Channel>( 403 return scoped_ptr<Channel>(
405 new ChannelNacl(channel_handle, mode, listener, broker)); 404 new ChannelNacl(channel_handle, mode, listener, broker));
406 } 405 }
407 406
408 } // namespace IPC 407 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_nacl.h ('k') | ipc/ipc_channel_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698