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

Side by Side Diff: mojo/edk/system/handle_table.h

Issue 1947083003: EDK: Replace HandleTable::GetDispatcher() with GetHandle(). (Closed) Base URL: https://github.com/domokit/mojo.git@work788_edk_handle_13.2
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.cc ('k') | mojo/edk/system/handle_table.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ 5 #ifndef MOJO_EDK_SYSTEM_HANDLE_TABLE_H_
6 #define MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ 6 #define MOJO_EDK_SYSTEM_HANDLE_TABLE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class HandleTable { 42 class HandleTable {
43 public: 43 public:
44 explicit HandleTable(size_t max_handle_table_size); 44 explicit HandleTable(size_t max_handle_table_size);
45 ~HandleTable(); 45 ~HandleTable();
46 46
47 // TODO(vtl): Replace the dispatcher-only methods with ones that either take a 47 // TODO(vtl): Replace the dispatcher-only methods with ones that either take a
48 // handle, or ones that deal in dispatchers *and* rights. (E.g., it might be 48 // handle, or ones that deal in dispatchers *and* rights. (E.g., it might be
49 // convenient for there to be a "GetDispatcher()" that automatically does 49 // convenient for there to be a "GetDispatcher()" that automatically does
50 // rights-checking.) 50 // rights-checking.)
51 51
52 // On success, gets the dispatcher for a given handle value (which should not 52 // On success, gets the handle for the given handle value (which should not be
53 // be |MOJO_HANDLE_INVALID|). On failure, returns an appropriate result (and 53 // |MOJO_HANDLE_INVALID|). On failure, returns an appropriate result (and
54 // leaves |dispatcher| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if 54 // leaves |*handle| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if there's
55 // there's no dispatcher for the given handle value or |MOJO_RESULT_BUSY| if 55 // no handle for the given handle value or |MOJO_RESULT_BUSY| if the handle is
56 // the handle value is marked as busy. 56 // marked as busy.
57 MojoResult GetDispatcher(MojoHandle handle_value, 57 MojoResult GetHandle(MojoHandle handle_value, Handle* handle);
58 util::RefPtr<Dispatcher>* dispatcher);
59 58
60 // Like |GetDispatcher()|, but on success also removes the handle value from 59 // Like |GetDispatcher()|, but on success also removes the handle value from
61 // the handle table. 60 // the handle table.
62 MojoResult GetAndRemoveDispatcher(MojoHandle handle_value, 61 MojoResult GetAndRemoveDispatcher(MojoHandle handle_value,
63 util::RefPtr<Dispatcher>* dispatcher); 62 util::RefPtr<Dispatcher>* dispatcher);
64 63
65 // Adds a handle (which must have a dispatcher), returning the handle value 64 // Adds a handle (which must have a dispatcher), returning the handle value
66 // for it. Returns |MOJO_HANDLE_INVALID| on failure (if the handle table is 65 // for it. Returns |MOJO_HANDLE_INVALID| on failure (if the handle table is
67 // full). 66 // full).
68 MojoHandle AddHandle(Handle&& handle); 67 MojoHandle AddHandle(Handle&& handle);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 HandleToEntryMap handle_to_entry_map_; 143 HandleToEntryMap handle_to_entry_map_;
145 MojoHandle next_handle_value_; // Invariant: never |MOJO_HANDLE_INVALID|. 144 MojoHandle next_handle_value_; // Invariant: never |MOJO_HANDLE_INVALID|.
146 145
147 MOJO_DISALLOW_COPY_AND_ASSIGN(HandleTable); 146 MOJO_DISALLOW_COPY_AND_ASSIGN(HandleTable);
148 }; 147 };
149 148
150 } // namespace system 149 } // namespace system
151 } // namespace mojo 150 } // namespace mojo
152 151
153 #endif // MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ 152 #endif // MOJO_EDK_SYSTEM_HANDLE_TABLE_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/core.cc ('k') | mojo/edk/system/handle_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698