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

Side by Side Diff: components/network_hints/public/cpp/network_hints_param_traits.cc

Issue 2179693002: Revert of Convert network hints to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/network_hints/public/cpp/network_hints_param_traits.h"
6
7 #include "base/strings/string_number_conversions.h"
8 #include "components/network_hints/common/network_hints_common.h"
9
10 namespace IPC {
11
12 void ParamTraits<network_hints::LookupRequest>::GetSize(base::PickleSizer* s,
13 const param_type& p) {
14 IPC::GetParamSize(s, p.hostname_list);
15 }
16
17 void ParamTraits<network_hints::LookupRequest>::Write(
18 base::Pickle* m,
19 const network_hints::LookupRequest& request) {
20 IPC::WriteParam(m, request.hostname_list);
21 }
22
23 bool ParamTraits<network_hints::LookupRequest>::Read(
24 const base::Pickle* m,
25 base::PickleIterator* iter,
26 network_hints::LookupRequest* request) {
27 // Verify the hostname limits after deserialization success.
28 if (IPC::ReadParam(m, iter, &request->hostname_list)) {
29 network_hints::NameList& hostnames = request->hostname_list;
30 if (hostnames.size() > network_hints::kMaxDnsHostnamesPerRequest)
31 return false;
32
33 for (const auto& hostname : hostnames) {
34 if (hostname.length() > network_hints::kMaxDnsHostnameLength)
35 return false;
36 }
37 }
38 return true;
39 }
40
41 void ParamTraits<network_hints::LookupRequest>::Log(
42 const network_hints::LookupRequest& p,
43 std::string* l) {
44 l->append("<network_hints::LookupRequest: ");
45 l->append(base::SizeTToString(p.hostname_list.size()));
46 l->append(" hostnames>");
47 }
48
49 } // namespace IPC
OLDNEW
« no previous file with comments | « components/network_hints/public/cpp/network_hints_param_traits.h ('k') | components/network_hints/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698