OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/message_port/web_message_port_channel_impl.h" | 5 #include "components/message_port/web_message_port_channel_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 blink::WebMessagePortChannel** channel2) { | 27 blink::WebMessagePortChannel** channel2) { |
28 mojo::ScopedMessagePipeHandle pipe1; | 28 mojo::ScopedMessagePipeHandle pipe1; |
29 mojo::ScopedMessagePipeHandle pipe2; | 29 mojo::ScopedMessagePipeHandle pipe2; |
30 MojoResult result = mojo::CreateMessagePipe(nullptr, &pipe1, &pipe2); | 30 MojoResult result = mojo::CreateMessagePipe(nullptr, &pipe1, &pipe2); |
31 if (result != MOJO_RESULT_OK) { | 31 if (result != MOJO_RESULT_OK) { |
32 NOTREACHED(); | 32 NOTREACHED(); |
33 return; | 33 return; |
34 } | 34 } |
35 | 35 |
36 *channel1 = new WebMessagePortChannelImpl(std::move(pipe1)); | 36 *channel1 = new WebMessagePortChannelImpl(std::move(pipe1)); |
37 ; | |
38 *channel2 = new WebMessagePortChannelImpl(std::move(pipe2)); | 37 *channel2 = new WebMessagePortChannelImpl(std::move(pipe2)); |
39 } | 38 } |
40 | 39 |
41 WebMessagePortChannelImpl::WebMessagePortChannelImpl( | 40 WebMessagePortChannelImpl::WebMessagePortChannelImpl( |
42 mojo::ScopedMessagePipeHandle pipe) | 41 mojo::ScopedMessagePipeHandle pipe) |
43 : client_(nullptr), pipe_(std::move(pipe)) { | 42 : client_(nullptr), pipe_(std::move(pipe)) { |
44 WaitForNextMessage(); | 43 WaitForNextMessage(); |
45 } | 44 } |
46 | 45 |
47 WebMessagePortChannelImpl::~WebMessagePortChannelImpl() { | 46 WebMessagePortChannelImpl::~WebMessagePortChannelImpl() { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return; | 135 return; |
137 | 136 |
138 DCHECK_EQ(MOJO_RESULT_OK, result); | 137 DCHECK_EQ(MOJO_RESULT_OK, result); |
139 if (!client_) | 138 if (!client_) |
140 return; | 139 return; |
141 client_->messageAvailable(); | 140 client_->messageAvailable(); |
142 WaitForNextMessage(); | 141 WaitForNextMessage(); |
143 } | 142 } |
144 | 143 |
145 } // namespace message_port | 144 } // namespace message_port |
OLD | NEW |