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

Unified Diff: mojo/edk/embedder/system_impl_private_entrypoints.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/edk/system/core.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/embedder/system_impl_private_entrypoints.cc
diff --git a/mojo/edk/embedder/system_impl_private_entrypoints.cc b/mojo/edk/embedder/system_impl_private_entrypoints.cc
index 79cd3096dc76d40264556864e2615577e83d0d56..f35c91f06abb1ad7d0abf950136c95ecda320386 100644
--- a/mojo/edk/embedder/system_impl_private_entrypoints.cc
+++ b/mojo/edk/embedder/system_impl_private_entrypoints.cc
@@ -20,6 +20,7 @@
using mojo::embedder::internal::g_core;
using mojo::system::Core;
using mojo::system::Dispatcher;
+using mojo::system::Handle;
using mojo::system::MakeUserPointer;
using mojo::util::RefPtr;
@@ -55,23 +56,23 @@ MojoResult MojoSystemImplTransferHandle(MojoSystemImpl from_system,
if (result_handle == nullptr)
return MOJO_RESULT_INVALID_ARGUMENT;
- RefPtr<Dispatcher> d;
- MojoResult result = from_core->GetAndRemoveDispatcher(handle, &d);
+ Handle h;
+ MojoResult result = from_core->GetAndRemoveHandle(handle, &h);
if (result != MOJO_RESULT_OK)
return result;
- // TODO(vtl): The rights should come from the original handle (to be dealt
- // with when I fix/replace |Core::GetAndRemoveDispatcher()|.
- MojoHandle created_handle = to_core->AddHandle(mojo::system::Handle(
- d.Clone(), MOJO_HANDLE_RIGHT_TRANSFER | MOJO_HANDLE_RIGHT_READ |
- MOJO_HANDLE_RIGHT_WRITE));
+ MojoHandle created_handle =
+ to_core->AddHandle(Handle(h.dispatcher.Clone(), h.rights));
if (created_handle == MOJO_HANDLE_INVALID) {
// The handle has been lost, unfortunately. There's no guarentee we can put
// it back where it came from, or get the original ID back. Holding locks
// for multiple cores risks deadlock, so that isn't a solution. This case
// should not happen for reasonable uses of this API, however.
+ // TODO(vtl): This behaviour is pretty crappy. This can be fixed by marking
+ // the original handle as busy and only removing it on success, though
+ // that'd require some work.
LOG(ERROR) << "Could not transfer handle";
- d->Close();
+ h.dispatcher->Close();
return MOJO_RESULT_RESOURCE_EXHAUSTED;
}
« no previous file with comments | « no previous file | mojo/edk/system/core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698