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 <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "base/task_runner.h" | 19 #include "base/task_runner.h" |
20 #include "mojo/edk/embedder/platform_handle_vector.h" | 20 #include "mojo/edk/embedder/platform_handle_vector.h" |
21 | 21 |
22 namespace mojo { | 22 namespace mojo { |
23 namespace edk { | 23 namespace edk { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 const size_t kMaxBatchReadCapacity = 256 * 1024; | |
28 | |
29 // A view over a Channel::Message object. The write queue uses these since | 27 // A view over a Channel::Message object. The write queue uses these since |
30 // large messages may need to be sent in chunks. | 28 // large messages may need to be sent in chunks. |
31 class MessageView { | 29 class MessageView { |
32 public: | 30 public: |
33 // Owns |message|. |offset| indexes the first unsent byte in the message. | 31 // Owns |message|. |offset| indexes the first unsent byte in the message. |
34 MessageView(Channel::MessagePtr message, size_t offset) | 32 MessageView(Channel::MessagePtr message, size_t offset) |
35 : message_(std::move(message)), | 33 : message_(std::move(message)), |
36 offset_(offset) { | 34 offset_(offset) { |
37 DCHECK_GT(message_->data_num_bytes(), offset_); | 35 DCHECK_GT(message_->data_num_bytes(), offset_); |
38 } | 36 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // static | 295 // static |
298 scoped_refptr<Channel> Channel::Create( | 296 scoped_refptr<Channel> Channel::Create( |
299 Delegate* delegate, | 297 Delegate* delegate, |
300 ScopedPlatformHandle platform_handle, | 298 ScopedPlatformHandle platform_handle, |
301 scoped_refptr<base::TaskRunner> io_task_runner) { | 299 scoped_refptr<base::TaskRunner> io_task_runner) { |
302 return new ChannelWin(delegate, std::move(platform_handle), io_task_runner); | 300 return new ChannelWin(delegate, std::move(platform_handle), io_task_runner); |
303 } | 301 } |
304 | 302 |
305 } // namespace edk | 303 } // namespace edk |
306 } // namespace mojo | 304 } // namespace mojo |
OLD | NEW |