Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Side by Side Diff: remoting/host/native_messaging/native_messaging_reader.cc

Issue 2230193002: remoting: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <cstdint> 7 #include <cstdint>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return; 104 return;
105 } 105 }
106 106
107 if (message_length > kMaximumMessageSize) { 107 if (message_length > kMaximumMessageSize) {
108 LOG(ERROR) << "Message size too large: " << message_length; 108 LOG(ERROR) << "Message size too large: " << message_length;
109 NotifyEof(); 109 NotifyEof();
110 return; 110 return;
111 } 111 }
112 112
113 std::string message_json(message_length, '\0'); 113 std::string message_json(message_length, '\0');
114 read_result = read_stream_.ReadAtCurrentPos(string_as_array(&message_json), 114 read_result = read_stream_.ReadAtCurrentPos(
115 message_length); 115 base::string_as_array(&message_json), message_length);
116 if (read_result != static_cast<int>(message_length)) { 116 if (read_result != static_cast<int>(message_length)) {
117 LOG(ERROR) << "Failed to read message body, read returned " 117 LOG(ERROR) << "Failed to read message body, read returned "
118 << read_result; 118 << read_result;
119 NotifyEof(); 119 NotifyEof();
120 return; 120 return;
121 } 121 }
122 122
123 std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json); 123 std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json);
124 if (!message) { 124 if (!message) {
125 LOG(ERROR) << "Failed to parse JSON message: " << message.get(); 125 LOG(ERROR) << "Failed to parse JSON message: " << message.get();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void NativeMessagingReader::InvokeMessageCallback( 194 void NativeMessagingReader::InvokeMessageCallback(
195 std::unique_ptr<base::Value> message) { 195 std::unique_ptr<base::Value> message) {
196 message_callback_.Run(std::move(message)); 196 message_callback_.Run(std::move(message));
197 } 197 }
198 198
199 void NativeMessagingReader::InvokeEofCallback() { 199 void NativeMessagingReader::InvokeEofCallback() {
200 eof_callback_.Run(); 200 eof_callback_.Run();
201 } 201 }
202 202
203 } // namespace remoting 203 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/linux/audio_pipe_reader.cc ('k') | remoting/host/native_messaging/native_messaging_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698