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

Side by Side Diff: mojo/system/core.cc

Issue 505863002: Mojo: Add static factory functions to MessagePipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 4 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 | « mojo/system/channel_unittest.cc ('k') | mojo/system/message_pipe.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/system/core.h" 5 #include "mojo/system/core.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 handle_pair = handle_table_.AddDispatcherPair(dispatcher0, dispatcher1); 201 handle_pair = handle_table_.AddDispatcherPair(dispatcher0, dispatcher1);
202 } 202 }
203 if (handle_pair.first == MOJO_HANDLE_INVALID) { 203 if (handle_pair.first == MOJO_HANDLE_INVALID) {
204 DCHECK_EQ(handle_pair.second, MOJO_HANDLE_INVALID); 204 DCHECK_EQ(handle_pair.second, MOJO_HANDLE_INVALID);
205 LOG(ERROR) << "Handle table full"; 205 LOG(ERROR) << "Handle table full";
206 dispatcher0->Close(); 206 dispatcher0->Close();
207 dispatcher1->Close(); 207 dispatcher1->Close();
208 return MOJO_RESULT_RESOURCE_EXHAUSTED; 208 return MOJO_RESULT_RESOURCE_EXHAUSTED;
209 } 209 }
210 210
211 scoped_refptr<MessagePipe> message_pipe(new MessagePipe()); 211 scoped_refptr<MessagePipe> message_pipe(MessagePipe::CreateLocalLocal());
212 dispatcher0->Init(message_pipe, 0); 212 dispatcher0->Init(message_pipe, 0);
213 dispatcher1->Init(message_pipe, 1); 213 dispatcher1->Init(message_pipe, 1);
214 214
215 message_pipe_handle0.Put(handle_pair.first); 215 message_pipe_handle0.Put(handle_pair.first);
216 message_pipe_handle1.Put(handle_pair.second); 216 message_pipe_handle1.Put(handle_pair.second);
217 return MOJO_RESULT_OK; 217 return MOJO_RESULT_OK;
218 } 218 }
219 219
220 // Implementation note: To properly cancel waiters and avoid other races, this 220 // Implementation note: To properly cancel waiters and avoid other races, this
221 // does not transfer dispatchers from one handle to another, even when sending a 221 // does not transfer dispatchers from one handle to another, even when sending a
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if (signals_states) { 597 if (signals_states) {
598 for (; i < num_handles; i++) 598 for (; i < num_handles; i++)
599 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); 599 signals_states[i] = dispatchers[i]->GetHandleSignalsState();
600 } 600 }
601 601
602 return rv; 602 return rv;
603 } 603 }
604 604
605 } // namespace system 605 } // namespace system
606 } // namespace mojo 606 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/channel_unittest.cc ('k') | mojo/system/message_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698