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

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

Issue 68993005: Mojo: More plumbing to support sending handles over MessagePipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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.cc ('k') | mojo/system/message_pipe_endpoint.h » ('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/limits.h" 8 #include "mojo/system/limits.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"
(...skipping 27 matching lines...) Expand all
38 lock().AssertAcquired(); 38 lock().AssertAcquired();
39 message_pipe_->Close(port_); 39 message_pipe_->Close(port_);
40 message_pipe_ = NULL; 40 message_pipe_ = NULL;
41 return MOJO_RESULT_OK; 41 return MOJO_RESULT_OK;
42 } 42 }
43 43
44 MojoResult MessagePipeDispatcher::WriteMessageImplNoLock( 44 MojoResult MessagePipeDispatcher::WriteMessageImplNoLock(
45 const void* bytes, uint32_t num_bytes, 45 const void* bytes, uint32_t num_bytes,
46 const std::vector<Dispatcher*>* dispatchers, 46 const std::vector<Dispatcher*>* dispatchers,
47 MojoWriteMessageFlags flags) { 47 MojoWriteMessageFlags flags) {
48 DCHECK(!dispatchers || (dispatchers->size() > 0 &&
49 dispatchers->size() <= kMaxMessageNumHandles));
50
48 lock().AssertAcquired(); 51 lock().AssertAcquired();
49 52
50 if (!VerifyUserPointer<void>(bytes, num_bytes)) 53 if (!VerifyUserPointer<void>(bytes, num_bytes))
51 return MOJO_RESULT_INVALID_ARGUMENT; 54 return MOJO_RESULT_INVALID_ARGUMENT;
52 if (num_bytes > kMaxMessageNumBytes) 55 if (num_bytes > kMaxMessageNumBytes)
53 return MOJO_RESULT_RESOURCE_EXHAUSTED; 56 return MOJO_RESULT_RESOURCE_EXHAUSTED;
54 57
55 if (dispatchers) {
56 DCHECK_GT(dispatchers->size(), 0u);
57 DCHECK_LE(dispatchers->size(), kMaxMessageNumHandles);
58
59 // TODO(vtl)
60 NOTIMPLEMENTED();
61 return MOJO_RESULT_UNIMPLEMENTED;
62 }
63
64 return message_pipe_->WriteMessage(port_, 58 return message_pipe_->WriteMessage(port_,
65 bytes, num_bytes, 59 bytes, num_bytes,
66 dispatchers, 60 dispatchers,
67 flags); 61 flags);
68 } 62 }
69 63
70 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock( 64 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
71 void* bytes, uint32_t* num_bytes, 65 void* bytes, uint32_t* num_bytes,
72 uint32_t max_num_dispatchers, 66 uint32_t max_num_dispatchers,
73 std::vector<scoped_refptr<Dispatcher> >* dispatchers, 67 std::vector<scoped_refptr<Dispatcher> >* dispatchers,
(...skipping 20 matching lines...) Expand all
94 return message_pipe_->AddWaiter(port_, waiter, flags, wake_result); 88 return message_pipe_->AddWaiter(port_, waiter, flags, wake_result);
95 } 89 }
96 90
97 void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) { 91 void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) {
98 lock().AssertAcquired(); 92 lock().AssertAcquired();
99 message_pipe_->RemoveWaiter(port_, waiter); 93 message_pipe_->RemoveWaiter(port_, waiter);
100 } 94 }
101 95
102 } // namespace system 96 } // namespace system
103 } // namespace mojo 97 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_pipe.cc ('k') | mojo/system/message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698