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

Unified Diff: mojo/edk/system/handle.h

Issue 1949283002: EDK: Replace HandleTable::GetAndRemoveDispatcher() with GetAndRemoveHandle(). (Closed) Base URL: https://github.com/domokit/mojo.git@work789_edk_handle_13.3-x-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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/core.cc ('k') | mojo/edk/system/handle_table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/handle.h
diff --git a/mojo/edk/system/handle.h b/mojo/edk/system/handle.h
index df7fac2753a03adda9b4a0c212250fdbe92bf58d..c02fa1d974702bfcc750fbffe76c071a33b33f92 100644
--- a/mojo/edk/system/handle.h
+++ b/mojo/edk/system/handle.h
@@ -32,9 +32,20 @@ struct Handle {
Handle& operator=(const Handle&);
Handle& operator=(Handle&&);
+ // Returns a new |Handle| with the same contents as this object. Useful when a
+ // function takes a |Handle&&| argument and the caller wants to retain its
+ // copy (rather than moving it).
+ Handle Clone() const { return *this; }
+
// A |Handle| tests as true if it actually has a dispatcher.
explicit operator bool() const { return !!dispatcher; }
+ bool operator==(const Handle& rhs) const {
+ return dispatcher == rhs.dispatcher && rights == rhs.rights;
+ }
+
+ bool operator!=(const Handle& rhs) const { return !operator==(rhs); }
+
void reset() { *this = Handle(); }
// Note: |dispatcher| is guaranteed to be null if default-constructed or
« no previous file with comments | « mojo/edk/system/core.cc ('k') | mojo/edk/system/handle_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698