OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/edk/system/channel.h" | 5 #include "mojo/edk/system/channel.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <windows.h> | 8 #include <windows.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 if (write_error) { | 112 if (write_error) { |
113 // Do not synchronously invoke OnError(). Write() may have been called by | 113 // Do not synchronously invoke OnError(). Write() may have been called by |
114 // the delegate and we don't want to re-enter it. | 114 // the delegate and we don't want to re-enter it. |
115 io_task_runner_->PostTask(FROM_HERE, | 115 io_task_runner_->PostTask(FROM_HERE, |
116 base::Bind(&ChannelWin::OnError, this)); | 116 base::Bind(&ChannelWin::OnError, this)); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 void LeakHandle() override { | 120 void LeakHandle() override { |
121 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); | 121 DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); |
122 leak_handle_ = true; | 122 leak_handle_ = true; |
123 } | 123 } |
124 | 124 |
125 bool GetReadPlatformHandles( | 125 bool GetReadPlatformHandles( |
126 size_t num_handles, | 126 size_t num_handles, |
127 const void* extra_header, | 127 const void* extra_header, |
128 size_t extra_header_size, | 128 size_t extra_header_size, |
129 ScopedPlatformHandleVectorPtr* handles) override { | 129 ScopedPlatformHandleVectorPtr* handles) override { |
130 if (num_handles > std::numeric_limits<uint16_t>::max()) | 130 if (num_handles > std::numeric_limits<uint16_t>::max()) |
131 return false; | 131 return false; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 if (leak_handle_) | 200 if (leak_handle_) |
201 ignore_result(handle_.release()); | 201 ignore_result(handle_.release()); |
202 handle_.reset(); | 202 handle_.reset(); |
203 | 203 |
204 // May destroy the |this| if it was the last reference. | 204 // May destroy the |this| if it was the last reference. |
205 self_ = nullptr; | 205 self_ = nullptr; |
206 } | 206 } |
207 | 207 |
208 // base::MessageLoop::DestructionObserver: | 208 // base::MessageLoop::DestructionObserver: |
209 void WillDestroyCurrentMessageLoop() override { | 209 void WillDestroyCurrentMessageLoop() override { |
210 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); | 210 DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); |
211 if (self_) | 211 if (self_) |
212 ShutDownOnIOThread(); | 212 ShutDownOnIOThread(); |
213 } | 213 } |
214 | 214 |
215 // base::MessageLoop::IOHandler: | 215 // base::MessageLoop::IOHandler: |
216 void OnIOCompleted(base::MessageLoopForIO::IOContext* context, | 216 void OnIOCompleted(base::MessageLoopForIO::IOContext* context, |
217 DWORD bytes_transfered, | 217 DWORD bytes_transfered, |
218 DWORD error) override { | 218 DWORD error) override { |
219 if (error != ERROR_SUCCESS) { | 219 if (error != ERROR_SUCCESS) { |
220 OnError(); | 220 OnError(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 scoped_refptr<Channel> Channel::Create( | 351 scoped_refptr<Channel> Channel::Create( |
352 Delegate* delegate, | 352 Delegate* delegate, |
353 ConnectionParams connection_params, | 353 ConnectionParams connection_params, |
354 scoped_refptr<base::TaskRunner> io_task_runner) { | 354 scoped_refptr<base::TaskRunner> io_task_runner) { |
355 return new ChannelWin(delegate, connection_params.TakeChannelHandle(), | 355 return new ChannelWin(delegate, connection_params.TakeChannelHandle(), |
356 io_task_runner); | 356 io_task_runner); |
357 } | 357 } |
358 | 358 |
359 } // namespace edk | 359 } // namespace edk |
360 } // namespace mojo | 360 } // namespace mojo |
OLD | NEW |