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

Unified Diff: mojo/edk/system/core.cc

Issue 1052723003: NaCl: create a separate namespace for Mojo handles. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
Index: mojo/edk/system/core.cc
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
index 80c3d367ba16858731d2c0527c4c073a7faee245..cde236ce19cd3ee770928685757d4feececd3385 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -97,6 +97,21 @@ scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) {
return handle_table_.GetDispatcher(handle);
}
+scoped_refptr<Dispatcher> Core::PopDispatcher(MojoHandle handle) {
+ if (handle == MOJO_HANDLE_INVALID)
+ return nullptr;
+
+ scoped_refptr<Dispatcher> dispatcher;
+ {
+ base::AutoLock locker(handle_table_lock_);
+ MojoResult result =
+ handle_table_.GetAndRemoveDispatcher(handle, &dispatcher);
+ if (result != MOJO_RESULT_OK)
+ return nullptr;
+ }
+ return dispatcher;
+}
+
MojoResult Core::AsyncWait(MojoHandle handle,
MojoHandleSignals signals,
const base::Callback<void(MojoResult)>& callback) {

Powered by Google App Engine
This is Rietveld 408576698