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 "remoting/host/native_messaging/native_messaging_reader.h" | 5 #include "remoting/host/native_messaging/native_messaging_reader.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <string> | 9 #include <string> |
8 | 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/files/file.h" | 12 #include "base/files/file.h" |
11 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
12 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" |
13 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
14 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
15 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
16 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
17 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
18 #include "base/values.h" | 21 #include "base/values.h" |
19 | 22 |
20 namespace { | 23 namespace { |
21 | 24 |
22 // uint32 is specified in the protocol as the type for the message header. | 25 // uint32_t is specified in the protocol as the type for the message header. |
23 typedef uint32 MessageLengthType; | 26 typedef uint32_t MessageLengthType; |
24 | 27 |
25 const int kMessageHeaderSize = sizeof(MessageLengthType); | 28 const int kMessageHeaderSize = sizeof(MessageLengthType); |
26 | 29 |
27 // Limit the size of received messages, to avoid excessive memory-allocation in | 30 // Limit the size of received messages, to avoid excessive memory-allocation in |
28 // this process, and potential overflow issues when casting to a signed 32-bit | 31 // this process, and potential overflow issues when casting to a signed 32-bit |
29 // int. | 32 // int. |
30 const MessageLengthType kMaximumMessageSize = 1024 * 1024; | 33 const MessageLengthType kMaximumMessageSize = 1024 * 1024; |
31 | 34 |
32 } // namespace | 35 } // namespace |
33 | 36 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 void NativeMessagingReader::InvokeMessageCallback( | 161 void NativeMessagingReader::InvokeMessageCallback( |
159 scoped_ptr<base::Value> message) { | 162 scoped_ptr<base::Value> message) { |
160 message_callback_.Run(message.Pass()); | 163 message_callback_.Run(message.Pass()); |
161 } | 164 } |
162 | 165 |
163 void NativeMessagingReader::InvokeEofCallback() { | 166 void NativeMessagingReader::InvokeEofCallback() { |
164 eof_callback_.Run(); | 167 eof_callback_.Run(); |
165 } | 168 } |
166 | 169 |
167 } // namespace remoting | 170 } // namespace remoting |
OLD | NEW |