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

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

Issue 1993983002: EDK: Add Core::GetRights(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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/edk/system/core.h ('k') | mojo/edk/system/core_test_base.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/edk/system/core.h" 5 #include "mojo/edk/system/core.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return result; 168 return result;
169 } 169 }
170 170
171 // The dispatcher doesn't have a say in being closed, but gets notified of it. 171 // The dispatcher doesn't have a say in being closed, but gets notified of it.
172 // Note: This is done outside of |handle_table_mutex_|. As a result, there's a 172 // Note: This is done outside of |handle_table_mutex_|. As a result, there's a
173 // race condition that the dispatcher must handle; see the comment in 173 // race condition that the dispatcher must handle; see the comment in
174 // |Dispatcher| in dispatcher.h. 174 // |Dispatcher| in dispatcher.h.
175 return h.dispatcher->Close(); 175 return h.dispatcher->Close();
176 } 176 }
177 177
178 MojoResult Core::GetRights(MojoHandle handle,
179 UserPointer<MojoHandleRights> rights) {
180 Handle h;
181 MojoResult result = GetHandle(handle, &h);
182 if (result != MOJO_RESULT_OK)
183 return result;
184
185 rights.Put(h.rights);
186 return MOJO_RESULT_OK;
187 }
188
178 MojoResult Core::Wait(MojoHandle handle, 189 MojoResult Core::Wait(MojoHandle handle,
179 MojoHandleSignals signals, 190 MojoHandleSignals signals,
180 MojoDeadline deadline, 191 MojoDeadline deadline,
181 UserPointer<MojoHandleSignalsState> signals_state) { 192 UserPointer<MojoHandleSignalsState> signals_state) {
182 uint32_t unused = static_cast<uint32_t>(-1); 193 uint32_t unused = static_cast<uint32_t>(-1);
183 HandleSignalsState hss; 194 HandleSignalsState hss;
184 MojoResult result = WaitManyInternal(&handle, &signals, 1, deadline, &unused, 195 MojoResult result = WaitManyInternal(&handle, &signals, 1, deadline, &unused,
185 signals_state.IsNull() ? nullptr : &hss); 196 signals_state.IsNull() ? nullptr : &hss);
186 if (result != MOJO_RESULT_INVALID_ARGUMENT && !signals_state.IsNull()) 197 if (result != MOJO_RESULT_INVALID_ARGUMENT && !signals_state.IsNull())
187 signals_state.Put(hss); 198 signals_state.Put(hss);
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 if (signals_states) { 761 if (signals_states) {
751 for (; i < num_handles; i++) 762 for (; i < num_handles; i++)
752 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); 763 signals_states[i] = dispatchers[i]->GetHandleSignalsState();
753 } 764 }
754 765
755 return result; 766 return result;
756 } 767 }
757 768
758 } // namespace system 769 } // namespace system
759 } // namespace mojo 770 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/core_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698