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

Unified Diff: mojo/system/core_impl.cc

Issue 220113003: Mojo: Implement MojoUnmapBuffer(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 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
« no previous file with comments | « mojo/system/core_impl.h ('k') | mojo/system/handle_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/core_impl.cc
diff --git a/mojo/system/core_impl.cc b/mojo/system/core_impl.cc
index f6f2808609b34cc3280c73c95d2225d493b2b93f..12c1be5756977212da38be4eccd4cfc2443bf09f 100644
--- a/mojo/system/core_impl.cc
+++ b/mojo/system/core_impl.cc
@@ -59,7 +59,7 @@ namespace system {
// (which subclasses can use to protect their data).
//
// The lock ordering is as follows:
-// 1. global handle table lock
+// 1. global handle table lock, global mapping table lock
// 2. |Dispatcher| locks
// 3. secondary object locks
// ...
@@ -503,19 +503,21 @@ MojoResult CoreImpl::MapBuffer(MojoHandle buffer_handle,
return result;
DCHECK(mapping);
- *buffer = mapping->base();
-
- // TODO(vtl): FIXME -- Record the mapping somewhere, so that it can be
- // unmapped properly. For now, just leak it.
- ignore_result(mapping.release());
+ void* address = mapping->base();
+ {
+ base::AutoLock locker(mapping_table_lock_);
+ result = mapping_table_.AddMapping(mapping.Pass());
+ }
+ if (result != MOJO_RESULT_OK)
+ return result;
+ *buffer = address;
return MOJO_RESULT_OK;
}
MojoResult CoreImpl::UnmapBuffer(void* buffer) {
- // TODO(vtl): FIXME
- NOTIMPLEMENTED();
- return MOJO_RESULT_UNIMPLEMENTED;
+ base::AutoLock locker(mapping_table_lock_);
+ return mapping_table_.RemoveMapping(buffer);
}
scoped_refptr<Dispatcher> CoreImpl::GetDispatcher(MojoHandle handle) {
« no previous file with comments | « mojo/system/core_impl.h ('k') | mojo/system/handle_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698