diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 21:16:11 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 21:16:11 +0000 |
commit | 602f2dd4ad787a55009f32dd773d2b0d2b139a11 (patch) | |
tree | b46bd1d0249c38a1c5b885ea8c43765fe260d728 /mojo | |
parent | 5799d052a1c347e58d49094f7abf706a08c1eb87 (diff) | |
download | chromium_src-602f2dd4ad787a55009f32dd773d2b0d2b139a11.zip chromium_src-602f2dd4ad787a55009f32dd773d2b0d2b139a11.tar.gz chromium_src-602f2dd4ad787a55009f32dd773d2b0d2b139a11.tar.bz2 |
Mojo: Rename "duplicate shared buffer" -> "duplicate buffer handle".
This is more accurate (since, in general, it's not the buffer that's being
duplicated, but the handle) and also allows us to potentially use the function
for other types of buffers (in the future).
R=darin@chromium.org
Review URL: https://codereview.chromium.org/136213004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/public/system/core.h | 51 | ||||
-rw-r--r-- | mojo/public/system/core_private.cc | 12 | ||||
-rw-r--r-- | mojo/public/system/core_private.h | 8 | ||||
-rw-r--r-- | mojo/system/core_impl.cc | 8 | ||||
-rw-r--r-- | mojo/system/core_impl.h | 8 |
5 files changed, 45 insertions, 42 deletions
diff --git a/mojo/public/system/core.h b/mojo/public/system/core.h index 4e8d911..bcded39 100644 --- a/mojo/public/system/core.h +++ b/mojo/public/system/core.h @@ -318,35 +318,35 @@ MOJO_COMPILE_ASSERT(sizeof(MojoCreateSharedBufferOptions) == 8, MojoCreateSharedBufferOptions_has_wrong_size); #endif -// |MojoDuplicateSharedBufferOptions|: Used to specify parameters in duplicating -// access to a shared buffer to |MojoDuplicateSharedBuffer()|. +// |MojoDuplicateBufferHandleOptions|: Used to specify parameters in duplicating +// access to a shared buffer to |MojoDuplicateBufferHandle()|. // |uint32_t struct_size|: Set to the size of the -// |MojoDuplicateSharedBufferOptions| struct. (Used to allow for future +// |MojoDuplicateBufferHandleOptions| struct. (Used to allow for future // extensions.) -// |MojoDuplicateSharedBufferOptionsFlags flags|: Reserved for future use. -// |MOJO_DUPLICATE_SHARED_BUFFER_OPTIONS_FLAG_NONE|: No flags; default +// |MojoDuplicateBufferHandleOptionsFlags flags|: Reserved for future use. +// |MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE|: No flags; default // mode. // // TODO(vtl): Add flags to remove writability (and executability)? Also, COW? -typedef uint32_t MojoDuplicateSharedBufferOptionsFlags; +typedef uint32_t MojoDuplicateBufferHandleOptionsFlags; #ifdef __cplusplus -const MojoDuplicateSharedBufferOptionsFlags - MOJO_DUPLICATE_SHARED_BUFFER_OPTIONS_FLAG_NONE = 0; +const MojoDuplicateBufferHandleOptionsFlags + MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0; #else -#define MOJO_DUPLICATE_SHARED_BUFFER_OPTIONS_FLAG_NONE \ - ((MojoDuplicateSharedBufferOptionsFlags) 0) +#define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \ + ((MojoDuplicateBufferHandleOptionsFlags) 0) #endif -struct MojoDuplicateSharedBufferOptions { +struct MojoDuplicateBufferHandleOptions { uint32_t struct_size; - MojoDuplicateSharedBufferOptionsFlags flags; + MojoDuplicateBufferHandleOptionsFlags flags; }; // TODO(vtl): Can we make this assertion work in C? #ifdef __cplusplus -MOJO_COMPILE_ASSERT(sizeof(MojoDuplicateSharedBufferOptions) == 8, - MojoDuplicateSharedBufferOptions_has_wrong_size); +MOJO_COMPILE_ASSERT(sizeof(MojoDuplicateBufferHandleOptions) == 8, + MojoDuplicateBufferHandleOptions_has_wrong_size); #endif // |MojoMapBufferFlags|: Used to specify different modes to |MojoMapBuffer()|. @@ -782,7 +782,7 @@ MOJO_SYSTEM_EXPORT MojoResult MojoEndReadData( // TODO(vtl): General comments. // Creates a buffer that can be shared between applications (by duplicating the -// handle -- see |MojoDuplicateSharedBuffer()| -- and passing it over a message +// handle -- see |MojoDuplicateBufferHandle()| -- and passing it over a message // pipe). To access the buffer, one must call |MojoMapBuffer()|. // TODO(vtl): More. MOJO_SYSTEM_EXPORT MojoResult MojoCreateSharedBuffer( @@ -790,15 +790,17 @@ MOJO_SYSTEM_EXPORT MojoResult MojoCreateSharedBuffer( uint64_t* num_bytes, // In/out. MojoHandle* shared_buffer_handle); // Out. -// Duplicates the handle |shared_buffer_handle| to a shared buffer. This creates -// another handle (returned in |*new_shared_buffer_handle| on success), which -// can then be sent to another application over a message pipe, while retaining -// access to the |shared_buffer_handle| (and any mappings that it may have). +// Duplicates the handle |buffer_handle| to a buffer. This creates another +// handle (returned in |*new_buffer_handle| on success), which can then be sent +// to another application over a message pipe, while retaining access to the +// |buffer_handle| (and any mappings that it may have). +// +// Note: We may add buffer types for which this operation is not supported. // TODO(vtl): More. -MOJO_SYSTEM_EXPORT MojoResult MojoDuplicateSharedBuffer( - MojoHandle shared_buffer_handle, - const struct MojoDuplicateSharedBufferOptions* options, // Optional. - MojoHandle* new_shared_buffer_handle); // Out. +MOJO_SYSTEM_EXPORT MojoResult MojoDuplicateBufferHandle( + MojoHandle buffer_handle, + const struct MojoDuplicateBufferHandleOptions* options, // Optional. + MojoHandle* new_buffer_handle); // Out. // Map the part (at offset |offset| of length |num_bytes|) of the buffer given // by |buffer_handle| into memory. |offset + num_bytes| must be less than or @@ -807,7 +809,8 @@ MOJO_SYSTEM_EXPORT MojoResult MojoDuplicateSharedBuffer( // // A single buffer handle may have multiple active mappings (possibly depending // on the buffer type). The permissions (e.g., writable or executable) of the -// returned memory may depend on the buffer/buffer handle as well as |flags|. +// returned memory may depend on the properties of the buffer and properties +// attached to the buffer handle as well as |flags|. // TODO(vtl): More. MOJO_SYSTEM_EXPORT MojoResult MojoMapBuffer(MojoHandle buffer_handle, uint64_t offset, diff --git a/mojo/public/system/core_private.cc b/mojo/public/system/core_private.cc index 469ef1e..1af11d3 100644 --- a/mojo/public/system/core_private.cc +++ b/mojo/public/system/core_private.cc @@ -128,13 +128,13 @@ MojoResult MojoCreateSharedBuffer( return g_core->CreateSharedBuffer(options, num_bytes, shared_buffer_handle); } -MojoResult MojoDuplicateSharedBuffer( - MojoHandle shared_buffer_handle, - const struct MojoDuplicateSharedBufferOptions* options, - MojoHandle* new_shared_buffer_handle) { +MojoResult MojoDuplicateBufferHandle( + MojoHandle buffer_handle, + const struct MojoDuplicateBufferHandleOptions* options, + MojoHandle* new_buffer_handle) { assert(g_core); - return g_core->DuplicateSharedBuffer(shared_buffer_handle, options, - new_shared_buffer_handle); + return g_core->DuplicateBufferHandle(buffer_handle, options, + new_buffer_handle); } MojoResult MojoMapBuffer(MojoHandle buffer_handle, diff --git a/mojo/public/system/core_private.h b/mojo/public/system/core_private.h index 0af0b25..1b4203e 100644 --- a/mojo/public/system/core_private.h +++ b/mojo/public/system/core_private.h @@ -70,10 +70,10 @@ class MOJO_SYSTEM_EXPORT Core { const MojoCreateSharedBufferOptions* options, uint64_t* num_bytes, MojoHandle* shared_buffer_handle) = 0; - virtual MojoResult DuplicateSharedBuffer( - MojoHandle shared_buffer_handle, - const MojoDuplicateSharedBufferOptions* options, - MojoHandle* new_shared_buffer_handle) = 0; + virtual MojoResult DuplicateBufferHandle( + MojoHandle buffer_handle, + const MojoDuplicateBufferHandleOptions* options, + MojoHandle* new_buffer_handle) = 0; virtual MojoResult MapBuffer(MojoHandle buffer_handle, uint64_t offset, uint64_t num_bytes, diff --git a/mojo/system/core_impl.cc b/mojo/system/core_impl.cc index af72919..51a5bef 100644 --- a/mojo/system/core_impl.cc +++ b/mojo/system/core_impl.cc @@ -495,10 +495,10 @@ MojoResult CoreImpl::CreateSharedBuffer( return MOJO_RESULT_UNIMPLEMENTED; } -MojoResult CoreImpl::DuplicateSharedBuffer( - MojoHandle shared_buffer_handle, - const MojoDuplicateSharedBufferOptions* options, - MojoHandle* new_shared_buffer_handle) { +MojoResult CoreImpl::DuplicateBufferHandle( + MojoHandle buffer_handle, + const MojoDuplicateBufferHandleOptions* options, + MojoHandle* new_buffer_handle) { // TODO(vtl) NOTIMPLEMENTED(); return MOJO_RESULT_UNIMPLEMENTED; diff --git a/mojo/system/core_impl.h b/mojo/system/core_impl.h index 5524d82..06e7345 100644 --- a/mojo/system/core_impl.h +++ b/mojo/system/core_impl.h @@ -87,10 +87,10 @@ class MOJO_SYSTEM_IMPL_EXPORT CoreImpl : public Core { const MojoCreateSharedBufferOptions* options, uint64_t* num_bytes, MojoHandle* shared_buffer_handle) OVERRIDE; - virtual MojoResult DuplicateSharedBuffer( - MojoHandle shared_buffer_handle, - const MojoDuplicateSharedBufferOptions* options, - MojoHandle* new_shared_buffer_handle) OVERRIDE; + virtual MojoResult DuplicateBufferHandle( + MojoHandle buffer_handle, + const MojoDuplicateBufferHandleOptions* options, + MojoHandle* new_buffer_handle) OVERRIDE; virtual MojoResult MapBuffer(MojoHandle buffer_handle, uint64_t offset, uint64_t num_bytes, |