OLD | NEW |
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/public/bindings/lib/connector.h" | 5 #include "mojo/public/bindings/lib/connector.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 void Connector::WriteMore() { | 113 void Connector::WriteMore() { |
114 while (!write_queue_.IsEmpty()) { | 114 while (!write_queue_.IsEmpty()) { |
115 const Message* message = write_queue_.Peek(); | 115 const Message* message = write_queue_.Peek(); |
116 | 116 |
117 MojoResult rv = WriteMessage(message_pipe_, | 117 MojoResult rv = WriteMessage(message_pipe_, |
118 message->data, | 118 message->data, |
119 message->data->header.num_bytes, | 119 message->data->header.num_bytes, |
120 message->handles.data(), | 120 message->handles.data(), |
121 message->handles.size(), | 121 static_cast<uint32_t>(message->handles.size()), |
122 MOJO_WRITE_MESSAGE_FLAG_NONE); | 122 MOJO_WRITE_MESSAGE_FLAG_NONE); |
123 if (rv == MOJO_RESULT_OK) { | 123 if (rv == MOJO_RESULT_OK) { |
124 // TODO(darin): Handles were successfully transferred, and so we need | 124 // TODO(darin): Handles were successfully transferred, and so we need |
125 // to take care not to Close them here. | 125 // to take care not to Close them here. |
126 write_queue_.Pop(); | 126 write_queue_.Pop(); |
127 continue; // Write another message. | 127 continue; // Write another message. |
128 } | 128 } |
129 | 129 |
130 error_ = true; | 130 error_ = true; |
131 break; | 131 break; |
(...skipping 21 matching lines...) Expand all Loading... |
153 } | 153 } |
154 | 154 |
155 void Connector::Callback::OnHandleReady(MojoResult result) { | 155 void Connector::Callback::OnHandleReady(MojoResult result) { |
156 assert(owner_); | 156 assert(owner_); |
157 Connector* owner = NULL; | 157 Connector* owner = NULL; |
158 std::swap(owner, owner_); | 158 std::swap(owner, owner_); |
159 owner->OnHandleReady(this, result); | 159 owner->OnHandleReady(this, result); |
160 } | 160 } |
161 | 161 |
162 } // namespace mojo | 162 } // namespace mojo |
OLD | NEW |