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

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

Issue 1957763002: EDK: Convert Core::GetAndRemoveDispatcher() to GetAndRemoveHandle(). (Closed) Base URL: https://github.com/domokit/mojo.git@work790_edk_handle_table_14.1-x-work789_edk_handle_table_14-x-work788_edk_handle_13.9-x-work787_edk_handle_13.8
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') | no next file » | 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 MojoResult Core::GetHandle(MojoHandle handle, Handle* h) { 100 MojoResult Core::GetHandle(MojoHandle handle, Handle* h) {
101 if (handle == MOJO_HANDLE_INVALID) 101 if (handle == MOJO_HANDLE_INVALID)
102 return MOJO_RESULT_INVALID_ARGUMENT; 102 return MOJO_RESULT_INVALID_ARGUMENT;
103 103
104 MutexLocker locker(&handle_table_mutex_); 104 MutexLocker locker(&handle_table_mutex_);
105 return handle_table_.GetHandle(handle, h); 105 return handle_table_.GetHandle(handle, h);
106 } 106 }
107 107
108 MojoResult Core::GetAndRemoveDispatcher(MojoHandle handle, 108 MojoResult Core::GetAndRemoveHandle(MojoHandle handle, Handle* h) {
109 RefPtr<Dispatcher>* dispatcher) {
110 if (handle == MOJO_HANDLE_INVALID) 109 if (handle == MOJO_HANDLE_INVALID)
111 return MOJO_RESULT_INVALID_ARGUMENT; 110 return MOJO_RESULT_INVALID_ARGUMENT;
112 111
113 MutexLocker locker(&handle_table_mutex_); 112 MutexLocker locker(&handle_table_mutex_);
114 Handle h; 113 return handle_table_.GetAndRemoveHandle(handle, h);
115 MojoResult result = handle_table_.GetAndRemoveHandle(handle, &h);
116 if (result == MOJO_RESULT_OK)
117 *dispatcher = std::move(h.dispatcher);
118 return result;
119 } 114 }
120 115
121 MojoResult Core::GetDispatcherAndCheckRights( 116 MojoResult Core::GetDispatcherAndCheckRights(
122 MojoHandle handle, 117 MojoHandle handle,
123 MojoHandleRights required_handle_rights, 118 MojoHandleRights required_handle_rights,
124 EntrypointClass entrypoint_class, 119 EntrypointClass entrypoint_class,
125 util::RefPtr<Dispatcher>* dispatcher) { 120 util::RefPtr<Dispatcher>* dispatcher) {
126 if (handle == MOJO_HANDLE_INVALID) 121 if (handle == MOJO_HANDLE_INVALID)
127 return MOJO_RESULT_INVALID_ARGUMENT; 122 return MOJO_RESULT_INVALID_ARGUMENT;
128 123
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 if (signals_states) { 748 if (signals_states) {
754 for (; i < num_handles; i++) 749 for (; i < num_handles; i++)
755 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); 750 signals_states[i] = dispatchers[i]->GetHandleSignalsState();
756 } 751 }
757 752
758 return result; 753 return result;
759 } 754 }
760 755
761 } // namespace system 756 } // namespace system
762 } // namespace mojo 757 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698