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

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

Issue 136343004: Mojo: Add a "GetType()" to Dispatchers. (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
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/simple_dispatcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "mojo/system/message_pipe_dispatcher.h" 5 #include "mojo/system/message_pipe_dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/system/constants.h" 8 #include "mojo/system/constants.h"
9 #include "mojo/system/memory.h" 9 #include "mojo/system/memory.h"
10 #include "mojo/system/message_pipe.h" 10 #include "mojo/system/message_pipe.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace system { 13 namespace system {
14 14
15 const unsigned kInvalidPort = static_cast<unsigned>(-1); 15 const unsigned kInvalidPort = static_cast<unsigned>(-1);
16 16
17 MessagePipeDispatcher::MessagePipeDispatcher() 17 MessagePipeDispatcher::MessagePipeDispatcher()
18 : port_(kInvalidPort) { 18 : port_(kInvalidPort) {
19 } 19 }
20 20
21 void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe, 21 void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe,
22 unsigned port) { 22 unsigned port) {
23 DCHECK(message_pipe.get()); 23 DCHECK(message_pipe.get());
24 DCHECK(port == 0 || port == 1); 24 DCHECK(port == 0 || port == 1);
25 25
26 message_pipe_ = message_pipe; 26 message_pipe_ = message_pipe;
27 port_ = port; 27 port_ = port;
28 } 28 }
29 29
30 Dispatcher::Type MessagePipeDispatcher::GetType() {
31 return kTypeMessagePipe;
32 }
33
30 MessagePipeDispatcher::~MessagePipeDispatcher() { 34 MessagePipeDispatcher::~MessagePipeDispatcher() {
31 // |Close()|/|CloseImplNoLock()| should have taken care of the pipe. 35 // |Close()|/|CloseImplNoLock()| should have taken care of the pipe.
32 DCHECK(!message_pipe_.get()); 36 DCHECK(!message_pipe_.get());
33 } 37 }
34 38
35 void MessagePipeDispatcher::CancelAllWaitersNoLock() { 39 void MessagePipeDispatcher::CancelAllWaitersNoLock() {
36 lock().AssertAcquired(); 40 lock().AssertAcquired();
37 message_pipe_->CancelAllWaiters(port_); 41 message_pipe_->CancelAllWaiters(port_);
38 } 42 }
39 43
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 107
104 scoped_refptr<MessagePipeDispatcher> rv = new MessagePipeDispatcher(); 108 scoped_refptr<MessagePipeDispatcher> rv = new MessagePipeDispatcher();
105 rv->Init(message_pipe_, port_); 109 rv->Init(message_pipe_, port_);
106 message_pipe_ = NULL; 110 message_pipe_ = NULL;
107 port_ = kInvalidPort; 111 port_ = kInvalidPort;
108 return scoped_refptr<Dispatcher>(rv.get()); 112 return scoped_refptr<Dispatcher>(rv.get());
109 } 113 }
110 114
111 } // namespace system 115 } // namespace system
112 } // namespace mojo 116 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/simple_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698