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

Side by Side Diff: components/network_hints/common/network_hints_messages.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/network_hints/common/network_hints_messages.h" 5 #include "components/network_hints/common/network_hints_messages.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "components/network_hints/common/network_hints_common.h" 8 #include "components/network_hints/common/network_hints_common.h"
9 9
10 namespace IPC { 10 namespace IPC {
11 11
12 void ParamTraits<network_hints::LookupRequest>::Write( 12 void ParamTraits<network_hints::LookupRequest>::Write(
13 Message* m, const network_hints::LookupRequest& request) { 13 Message* m, const network_hints::LookupRequest& request) {
14 IPC::WriteParam(m, request.hostname_list); 14 IPC::WriteParam(m, request.hostname_list);
15 } 15 }
16 16
17 bool ParamTraits<network_hints::LookupRequest>::Read( 17 bool ParamTraits<network_hints::LookupRequest>::Read(
18 const Message* m, 18 const Message* m,
19 PickleIterator* iter, 19 base::PickleIterator* iter,
20 network_hints::LookupRequest* request) { 20 network_hints::LookupRequest* request) {
21 // Verify the hostname limits after deserialization success. 21 // Verify the hostname limits after deserialization success.
22 if (IPC::ReadParam(m, iter, &request->hostname_list)) { 22 if (IPC::ReadParam(m, iter, &request->hostname_list)) {
23 network_hints::NameList& hostnames = request->hostname_list; 23 network_hints::NameList& hostnames = request->hostname_list;
24 if (hostnames.size() > network_hints::kMaxDnsHostnamesPerRequest) 24 if (hostnames.size() > network_hints::kMaxDnsHostnamesPerRequest)
25 return false; 25 return false;
26 26
27 for (const auto& hostname : hostnames) { 27 for (const auto& hostname : hostnames) {
28 if (hostname.length() > network_hints::kMaxDnsHostnameLength) 28 if (hostname.length() > network_hints::kMaxDnsHostnameLength)
29 return false; 29 return false;
30 } 30 }
31 } 31 }
32 return true; 32 return true;
33 } 33 }
34 34
35 void ParamTraits<network_hints::LookupRequest>::Log( 35 void ParamTraits<network_hints::LookupRequest>::Log(
36 const network_hints::LookupRequest& p, std::string* l) { 36 const network_hints::LookupRequest& p, std::string* l) {
37 l->append("<network_hints::LookupRequest: "); 37 l->append("<network_hints::LookupRequest: ");
38 l->append(base::SizeTToString(p.hostname_list.size())); 38 l->append(base::SizeTToString(p.hostname_list.size()));
39 l->append(" hostnames>"); 39 l->append(" hostnames>");
40 } 40 }
41 41
42 } // namespace IPC 42 } // namespace IPC
OLDNEW
« no previous file with comments | « components/nacl/zygote/nacl_fork_delegate_linux.cc ('k') | components/password_manager/core/browser/login_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698