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

Side by Side Diff: mojo/system/message_pipe_dispatcher.h

Issue 145483005: Mojo: More work towards sending message pipe handles over remote message pipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
6 #define MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 6 #define MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "mojo/system/dispatcher.h" 11 #include "mojo/system/dispatcher.h"
12 #include "mojo/system/system_impl_export.h" 12 #include "mojo/system/system_impl_export.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace system { 15 namespace system {
16 16
17 class MessagePipe; 17 class MessagePipe;
18 18
19 // This is the |Dispatcher| implementation for message pipes (created by the 19 // This is the |Dispatcher| implementation for message pipes (created by the
20 // Mojo primitive |MojoCreateMessagePipe()|). This class is thread-safe. 20 // Mojo primitive |MojoCreateMessagePipe()|). This class is thread-safe.
21 class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher : public Dispatcher { 21 class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher : public Dispatcher {
22 public: 22 public:
23 MessagePipeDispatcher(); 23 MessagePipeDispatcher();
24 24
25 // Must be called before any other methods. (This method is not thread-safe.) 25 // Must be called before any other methods. (This method is not thread-safe.)
26 void Init(scoped_refptr<MessagePipe> message_pipe, unsigned port); 26 void Init(scoped_refptr<MessagePipe> message_pipe, unsigned port);
27 27
28 // Gets a dumb pointer to |message_pipe_|. This must be called under the
29 // |Dispatcher| lock. Note that it returns a dumb pointer. (This is okay,
30 // since the lock is held, and you're being careful, right?) This is needed
31 // when sending handles across processes, where nontrivial, invasive work
32 // needs to be done.
DaveMoore 2014/02/03 20:01:15 Could this functionality be expressed through a se
viettrungluu 2014/02/03 20:09:11 I considered that, but friends get access to every
33 MessagePipe* GetMessagePipeNoLock() const;
34 // Similarly for the port.
35 unsigned GetPortNoLock() const;
36
28 virtual Type GetType() OVERRIDE; 37 virtual Type GetType() OVERRIDE;
29 38
30 private: 39 private:
31 friend class base::RefCountedThreadSafe<MessagePipeDispatcher>; 40 friend class base::RefCountedThreadSafe<MessagePipeDispatcher>;
32 virtual ~MessagePipeDispatcher(); 41 virtual ~MessagePipeDispatcher();
33 42
34 // |Dispatcher| implementation/overrides: 43 // |Dispatcher| implementation/overrides:
35 virtual void CancelAllWaitersNoLock() OVERRIDE; 44 virtual void CancelAllWaitersNoLock() OVERRIDE;
36 virtual MojoResult CloseImplNoLock() OVERRIDE; 45 virtual MojoResult CloseImplNoLock() OVERRIDE;
37 virtual MojoResult WriteMessageImplNoLock( 46 virtual MojoResult WriteMessageImplNoLock(
(...skipping 16 matching lines...) Expand all
54 scoped_refptr<MessagePipe> message_pipe_; // This will be null if closed. 63 scoped_refptr<MessagePipe> message_pipe_; // This will be null if closed.
55 unsigned port_; 64 unsigned port_;
56 65
57 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); 66 DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher);
58 }; 67 };
59 68
60 } // namespace system 69 } // namespace system
61 } // namespace mojo 70 } // namespace mojo
62 71
63 #endif // MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 72 #endif // MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698