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

Unified Diff: mojo/system/shared_buffer_dispatcher.cc

Issue 471773002: Mojo: Add a platform interface for shared memory (embedder::PlatformSharedBuffer). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 6 years, 4 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/shared_buffer_dispatcher.h ('k') | mojo/system/shared_buffer_dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/shared_buffer_dispatcher.cc
diff --git a/mojo/system/shared_buffer_dispatcher.cc b/mojo/system/shared_buffer_dispatcher.cc
index e5c4059953eeedc6f3da4684641f1a50f37696e7..7e046d7aea97ef410663607f0728569c768420f7 100644
--- a/mojo/system/shared_buffer_dispatcher.cc
+++ b/mojo/system/shared_buffer_dispatcher.cc
@@ -70,7 +70,8 @@ MojoResult SharedBufferDispatcher::Create(
if (num_bytes > kMaxSharedMemoryNumBytes)
return MOJO_RESULT_RESOURCE_EXHAUSTED;
- scoped_refptr<RawSharedBuffer> shared_buffer(
+ // TODO(vtl): Call out to "platform support" for this.
+ scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer(
RawSharedBuffer::Create(static_cast<size_t>(num_bytes)));
if (!shared_buffer)
return MOJO_RESULT_RESOURCE_EXHAUSTED;
@@ -119,7 +120,7 @@ scoped_refptr<SharedBufferDispatcher> SharedBufferDispatcher::Deserialize(
// Wrapping |platform_handle| in a |ScopedPlatformHandle| means that it'll be
// closed even if creation fails.
- scoped_refptr<RawSharedBuffer> shared_buffer(
+ scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer(
RawSharedBuffer::CreateFromPlatformHandle(
num_bytes, embedder::ScopedPlatformHandle(platform_handle)));
if (!shared_buffer) {
@@ -133,7 +134,7 @@ scoped_refptr<SharedBufferDispatcher> SharedBufferDispatcher::Deserialize(
}
SharedBufferDispatcher::SharedBufferDispatcher(
- scoped_refptr<RawSharedBuffer> shared_buffer)
+ scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer)
: shared_buffer_(shared_buffer) {
DCHECK(shared_buffer_);
}
@@ -183,7 +184,7 @@ scoped_refptr<Dispatcher>
SharedBufferDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
lock().AssertAcquired();
DCHECK(shared_buffer_);
- scoped_refptr<RawSharedBuffer> shared_buffer;
+ scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer;
shared_buffer.swap(shared_buffer_);
return scoped_refptr<Dispatcher>(new SharedBufferDispatcher(shared_buffer));
}
@@ -206,7 +207,7 @@ MojoResult SharedBufferDispatcher::MapBufferImplNoLock(
uint64_t offset,
uint64_t num_bytes,
MojoMapBufferFlags flags,
- scoped_ptr<RawSharedBufferMapping>* mapping) {
+ scoped_ptr<embedder::PlatformSharedBufferMapping>* mapping) {
lock().AssertAcquired();
DCHECK(shared_buffer_);
@@ -258,7 +259,7 @@ bool SharedBufferDispatcher::EndSerializeAndCloseImplNoLock(
return false;
}
- serialization->num_bytes = shared_buffer_->num_bytes();
+ serialization->num_bytes = shared_buffer_->GetNumBytes();
serialization->platform_handle_index = platform_handles->size();
platform_handles->push_back(platform_handle.release());
*actual_size = sizeof(SerializedSharedBufferDispatcher);
« no previous file with comments | « mojo/system/shared_buffer_dispatcher.h ('k') | mojo/system/shared_buffer_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698