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

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

Issue 140503005: Mojo: foo_[0-9] -> foo[0-9]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/tests/system/core_unittest.cc ('k') | mojo/system/core_impl_unittest.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 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_impl.h" 5 #include "mojo/system/core_impl.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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return WaitManyInternal(handles, flags, num_handles, deadline); 148 return WaitManyInternal(handles, flags, num_handles, deadline);
149 } 149 }
150 150
151 MojoResult CoreImpl::CreateMessagePipe(MojoHandle* message_pipe_handle0, 151 MojoResult CoreImpl::CreateMessagePipe(MojoHandle* message_pipe_handle0,
152 MojoHandle* message_pipe_handle1) { 152 MojoHandle* message_pipe_handle1) {
153 if (!VerifyUserPointer<MojoHandle>(message_pipe_handle0, 1)) 153 if (!VerifyUserPointer<MojoHandle>(message_pipe_handle0, 1))
154 return MOJO_RESULT_INVALID_ARGUMENT; 154 return MOJO_RESULT_INVALID_ARGUMENT;
155 if (!VerifyUserPointer<MojoHandle>(message_pipe_handle1, 1)) 155 if (!VerifyUserPointer<MojoHandle>(message_pipe_handle1, 1))
156 return MOJO_RESULT_INVALID_ARGUMENT; 156 return MOJO_RESULT_INVALID_ARGUMENT;
157 157
158 scoped_refptr<MessagePipeDispatcher> dispatcher_0( 158 scoped_refptr<MessagePipeDispatcher> dispatcher0(new MessagePipeDispatcher());
159 new MessagePipeDispatcher()); 159 scoped_refptr<MessagePipeDispatcher> dispatcher1(new MessagePipeDispatcher());
160 scoped_refptr<MessagePipeDispatcher> dispatcher_1(
161 new MessagePipeDispatcher());
162 160
163 MojoHandle h0, h1; 161 MojoHandle h0, h1;
164 { 162 {
165 base::AutoLock locker(handle_table_lock_); 163 base::AutoLock locker(handle_table_lock_);
166 164
167 h0 = AddDispatcherNoLock(dispatcher_0); 165 h0 = AddDispatcherNoLock(dispatcher0);
168 if (h0 == MOJO_HANDLE_INVALID) 166 if (h0 == MOJO_HANDLE_INVALID)
169 return MOJO_RESULT_RESOURCE_EXHAUSTED; 167 return MOJO_RESULT_RESOURCE_EXHAUSTED;
170 168
171 h1 = AddDispatcherNoLock(dispatcher_1); 169 h1 = AddDispatcherNoLock(dispatcher1);
172 if (h1 == MOJO_HANDLE_INVALID) { 170 if (h1 == MOJO_HANDLE_INVALID) {
173 handle_table_.erase(h0); 171 handle_table_.erase(h0);
174 return MOJO_RESULT_RESOURCE_EXHAUSTED; 172 return MOJO_RESULT_RESOURCE_EXHAUSTED;
175 } 173 }
176 } 174 }
177 175
178 scoped_refptr<MessagePipe> message_pipe(new MessagePipe()); 176 scoped_refptr<MessagePipe> message_pipe(new MessagePipe());
179 dispatcher_0->Init(message_pipe, 0); 177 dispatcher0->Init(message_pipe, 0);
180 dispatcher_1->Init(message_pipe, 1); 178 dispatcher1->Init(message_pipe, 1);
181 179
182 *message_pipe_handle0 = h0; 180 *message_pipe_handle0 = h0;
183 *message_pipe_handle1 = h1; 181 *message_pipe_handle1 = h1;
184 return MOJO_RESULT_OK; 182 return MOJO_RESULT_OK;
185 } 183 }
186 184
187 MojoResult CoreImpl::WriteMessage(MojoHandle message_pipe_handle, 185 MojoResult CoreImpl::WriteMessage(MojoHandle message_pipe_handle,
188 const void* bytes, 186 const void* bytes,
189 uint32_t num_bytes, 187 uint32_t num_bytes,
190 const MojoHandle* handles, 188 const MojoHandle* handles,
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be 561 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be
564 // destroyed, but this would still be required if the waiter were in TLS.) 562 // destroyed, but this would still be required if the waiter were in TLS.)
565 for (i = 0; i < num_added; i++) 563 for (i = 0; i < num_added; i++)
566 dispatchers[i]->RemoveWaiter(&waiter); 564 dispatchers[i]->RemoveWaiter(&waiter);
567 565
568 return rv; 566 return rv;
569 } 567 }
570 568
571 } // namespace system 569 } // namespace system
572 } // namespace mojo 570 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/tests/system/core_unittest.cc ('k') | mojo/system/core_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698