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

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

Issue 1957713003: EDK: Remove Core::GetDispatcher(). (Closed) Base URL: https://github.com/domokit/mojo.git@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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_H_ 5 #ifndef MOJO_EDK_SYSTEM_HANDLE_H_
6 #define MOJO_EDK_SYSTEM_HANDLE_H_ 6 #define MOJO_EDK_SYSTEM_HANDLE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "mojo/edk/util/ref_ptr.h" 10 #include "mojo/edk/util/ref_ptr.h"
(...skipping 30 matching lines...) Expand all
41 explicit operator bool() const { return !!dispatcher; } 41 explicit operator bool() const { return !!dispatcher; }
42 42
43 bool operator==(const Handle& rhs) const { 43 bool operator==(const Handle& rhs) const {
44 return dispatcher == rhs.dispatcher && rights == rhs.rights; 44 return dispatcher == rhs.dispatcher && rights == rhs.rights;
45 } 45 }
46 46
47 bool operator!=(const Handle& rhs) const { return !operator==(rhs); } 47 bool operator!=(const Handle& rhs) const { return !operator==(rhs); }
48 48
49 void reset() { *this = Handle(); } 49 void reset() { *this = Handle(); }
50 50
51 bool has_all_rights(MojoHandleRights required_rights) const {
52 return (rights & required_rights) == required_rights;
53 }
54
51 // Note: |dispatcher| is guaranteed to be null if default-constructed or 55 // Note: |dispatcher| is guaranteed to be null if default-constructed or
52 // moved-from, but we make no guarantees about the value of |rights| in either 56 // moved-from, but we make no guarantees about the value of |rights| in either
53 // case. 57 // case.
54 util::RefPtr<Dispatcher> dispatcher; 58 util::RefPtr<Dispatcher> dispatcher;
55 MojoHandleRights rights; 59 MojoHandleRights rights;
56 }; 60 };
57 61
58 using HandleVector = std::vector<Handle>; 62 using HandleVector = std::vector<Handle>;
59 63
60 } // namespace system 64 } // namespace system
61 } // namespace mojo 65 } // namespace mojo
62 66
63 #endif // MOJO_EDK_SYSTEM_HANDLE_H_ 67 #endif // MOJO_EDK_SYSTEM_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698