cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / network_hints / common / network_hints_messages.cc
blob82eaf6e0283156e5dc70b697b52c85d12a28fa18
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.
5 #include "components/network_hints/common/network_hints_messages.h"
7 #include "base/strings/string_number_conversions.h"
8 #include "components/network_hints/common/network_hints_common.h"
10 namespace IPC {
12 void ParamTraits<network_hints::LookupRequest>::Write(
13 Message* m, const network_hints::LookupRequest& request) {
14 IPC::WriteParam(m, request.hostname_list);
17 bool ParamTraits<network_hints::LookupRequest>::Read(
18 const Message* m,
19 base::PickleIterator* iter,
20 network_hints::LookupRequest* request) {
21 // Verify the hostname limits after deserialization success.
22 if (IPC::ReadParam(m, iter, &request->hostname_list)) {
23 network_hints::NameList& hostnames = request->hostname_list;
24 if (hostnames.size() > network_hints::kMaxDnsHostnamesPerRequest)
25 return false;
27 for (const auto& hostname : hostnames) {
28 if (hostname.length() > network_hints::kMaxDnsHostnameLength)
29 return false;
32 return true;
35 void ParamTraits<network_hints::LookupRequest>::Log(
36 const network_hints::LookupRequest& p, std::string* l) {
37 l->append("<network_hints::LookupRequest: ");
38 l->append(base::SizeTToString(p.hostname_list.size()));
39 l->append(" hostnames>");
42 } // namespace IPC