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

Unified Diff: mojo/edk/system/shared_buffer_dispatcher.h

Issue 1412283002: Convert mojo::system::Dispatcher to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: no change Created 5 years, 2 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/edk/system/remote_message_pipe_unittest.cc ('k') | mojo/edk/system/shared_buffer_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/shared_buffer_dispatcher.h
diff --git a/mojo/edk/system/shared_buffer_dispatcher.h b/mojo/edk/system/shared_buffer_dispatcher.h
index 9032fa016637226cdcb5e0344622c5fca8fe6b06..c61bd5cff545ffec68386eb048d7779fc180152c 100644
--- a/mojo/edk/system/shared_buffer_dispatcher.h
+++ b/mojo/edk/system/shared_buffer_dispatcher.h
@@ -7,6 +7,7 @@
#include "mojo/edk/embedder/platform_shared_buffer.h"
#include "mojo/edk/system/memory.h"
+#include "mojo/edk/system/ref_ptr.h"
#include "mojo/edk/system/simple_dispatcher.h"
#include "mojo/public/cpp/system/macros.h"
@@ -38,30 +39,29 @@ class SharedBufferDispatcher final : public SimpleDispatcher {
MojoCreateSharedBufferOptions* out_options);
// Static factory method: |validated_options| must be validated (obviously).
- // On failure, |*result| will be left as-is.
- // TODO(vtl): This should probably be made to return a scoped_refptr and have
- // a MojoResult out parameter instead.
- static MojoResult Create(
+ // Returns null on error; |*result| will be set to an appropriate result
+ // code).
+ static RefPtr<SharedBufferDispatcher> Create(
embedder::PlatformSupport* platform_support,
const MojoCreateSharedBufferOptions& validated_options,
uint64_t num_bytes,
- scoped_refptr<SharedBufferDispatcher>* result);
+ MojoResult* result);
// |Dispatcher| public methods:
Type GetType() const override;
// The "opposite" of |SerializeAndClose()|. (Typically this is called by
// |Dispatcher::Deserialize()|.)
- static scoped_refptr<SharedBufferDispatcher> Deserialize(
+ static RefPtr<SharedBufferDispatcher> Deserialize(
Channel* channel,
const void* source,
size_t size,
embedder::PlatformHandleVector* platform_handles);
private:
- static scoped_refptr<SharedBufferDispatcher> CreateInternal(
+ static RefPtr<SharedBufferDispatcher> CreateInternal(
scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer) {
- return make_scoped_refptr(new SharedBufferDispatcher(shared_buffer.Pass()));
+ return AdoptRef(new SharedBufferDispatcher(shared_buffer.Pass()));
}
explicit SharedBufferDispatcher(
@@ -79,11 +79,10 @@ class SharedBufferDispatcher final : public SimpleDispatcher {
// |Dispatcher| protected methods:
void CloseImplNoLock() override;
- scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
- override;
+ RefPtr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock() override;
MojoResult DuplicateBufferHandleImplNoLock(
UserPointer<const MojoDuplicateBufferHandleOptions> options,
- scoped_refptr<Dispatcher>* new_dispatcher) override;
+ RefPtr<Dispatcher>* new_dispatcher) override;
MojoResult MapBufferImplNoLock(
uint64_t offset,
uint64_t num_bytes,
« no previous file with comments | « mojo/edk/system/remote_message_pipe_unittest.cc ('k') | mojo/edk/system/shared_buffer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698