| Index: content/common/network_traffic_annotation_param_traits.cc
|
| diff --git a/content/common/network_traffic_annotation_param_traits.cc b/content/common/network_traffic_annotation_param_traits.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e297198d0fb1d20a88b5d7277a6fe8f71d2e82c4
|
| --- /dev/null
|
| +++ b/content/common/network_traffic_annotation_param_traits.cc
|
| @@ -0,0 +1,90 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/common/network_traffic_annotation_param_traits.h"
|
| +
|
| +namespace IPC {
|
| +
|
| +void ParamTraits<net::MutableNetworkTrafficAnnotationTag>::GetSize(
|
| + base::PickleSizer* s,
|
| + const param_type& p) {
|
| + GetParamSize(s, p.unique_id_hash_code);
|
| +}
|
| +
|
| +void ParamTraits<net::MutableNetworkTrafficAnnotationTag>::Write(
|
| + base::Pickle* m,
|
| + const param_type& p) {
|
| + m->WriteInt(p.unique_id_hash_code);
|
| +}
|
| +
|
| +bool ParamTraits<net::MutableNetworkTrafficAnnotationTag>::Read(
|
| + const base::Pickle* m,
|
| + base::PickleIterator* iter,
|
| + param_type* p) {
|
| + int32_t unique_id_hash_code;
|
| + if (!iter->ReadInt(&unique_id_hash_code))
|
| + return false;
|
| + p->unique_id_hash_code = unique_id_hash_code;
|
| + return true;
|
| +}
|
| +
|
| +void ParamTraits<net::MutableNetworkTrafficAnnotationTag>::Log(
|
| + const param_type& p,
|
| + std::string* l) {
|
| + l->append("(");
|
| + LogParam(p.unique_id_hash_code, l);
|
| + l->append(")");
|
| +}
|
| +
|
| +void ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::GetSize(
|
| + base::PickleSizer* s,
|
| + const param_type& p) {
|
| + GetParamSize(s, p.unique_id_hash_code);
|
| +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
|
| + GetParamSize(s, p.completing_id_hash_code);
|
| +#endif
|
| +}
|
| +
|
| +void ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::Write(
|
| + base::Pickle* m,
|
| + const param_type& p) {
|
| + m->WriteInt(p.unique_id_hash_code);
|
| +
|
| +// |completing_id_hash_code| is only stored and needed when DCHECKs are on.
|
| +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
|
| + m->WriteInt(p.completing_id_hash_code);
|
| +#endif
|
| +}
|
| +
|
| +bool ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::Read(
|
| + const base::Pickle* m,
|
| + base::PickleIterator* iter,
|
| + param_type* p) {
|
| + int32_t unique_id_hash_code;
|
| + if (!iter->ReadInt(&unique_id_hash_code))
|
| + return false;
|
| + p->unique_id_hash_code = unique_id_hash_code;
|
| +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
|
| + int32_t completing_id_hash_code;
|
| + if (!iter->ReadInt(&completing_id_hash_code))
|
| + return false;
|
| + p->completing_id_hash_code = completing_id_hash_code;
|
| +#endif
|
| +
|
| + return true;
|
| +}
|
| +
|
| +void ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::Log(
|
| + const param_type& p,
|
| + std::string* l) {
|
| + l->append("(");
|
| + LogParam(p.unique_id_hash_code, l);
|
| +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
|
| + l->append(", ");
|
| + LogParam(p.completing_id_hash_code, l);
|
| +#endif
|
| + l->append(")");
|
| +}
|
| +
|
| +} // namespace IPC
|
|
|