| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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 "content/common/network_traffic_annotation_param_traits.h" |
| 6 |
| 7 namespace IPC { |
| 8 |
| 9 void ParamTraits<net::MutableNetworkTrafficAnnotationTag>::GetSize( |
| 10 base::PickleSizer* s, |
| 11 const param_type& p) { |
| 12 GetParamSize(s, p.unique_id_hash_code); |
| 13 } |
| 14 |
| 15 void ParamTraits<net::MutableNetworkTrafficAnnotationTag>::Write( |
| 16 base::Pickle* m, |
| 17 const param_type& p) { |
| 18 m->WriteInt(p.unique_id_hash_code); |
| 19 } |
| 20 |
| 21 bool ParamTraits<net::MutableNetworkTrafficAnnotationTag>::Read( |
| 22 const base::Pickle* m, |
| 23 base::PickleIterator* iter, |
| 24 param_type* p) { |
| 25 int32_t unique_id_hash_code; |
| 26 if (!iter->ReadInt(&unique_id_hash_code)) |
| 27 return false; |
| 28 p->unique_id_hash_code = unique_id_hash_code; |
| 29 return true; |
| 30 } |
| 31 |
| 32 void ParamTraits<net::MutableNetworkTrafficAnnotationTag>::Log( |
| 33 const param_type& p, |
| 34 std::string* l) { |
| 35 l->append("("); |
| 36 LogParam(p.unique_id_hash_code, l); |
| 37 l->append(")"); |
| 38 } |
| 39 |
| 40 void ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::GetSize( |
| 41 base::PickleSizer* s, |
| 42 const param_type& p) { |
| 43 GetParamSize(s, p.unique_id_hash_code); |
| 44 #if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) |
| 45 GetParamSize(s, p.completing_id_hash_code); |
| 46 #endif |
| 47 } |
| 48 |
| 49 void ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::Write( |
| 50 base::Pickle* m, |
| 51 const param_type& p) { |
| 52 m->WriteInt(p.unique_id_hash_code); |
| 53 |
| 54 // |completing_id_hash_code| is only stored and needed when DCHECKs are on. |
| 55 #if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) |
| 56 m->WriteInt(p.completing_id_hash_code); |
| 57 #endif |
| 58 } |
| 59 |
| 60 bool ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::Read( |
| 61 const base::Pickle* m, |
| 62 base::PickleIterator* iter, |
| 63 param_type* p) { |
| 64 int32_t unique_id_hash_code; |
| 65 if (!iter->ReadInt(&unique_id_hash_code)) |
| 66 return false; |
| 67 p->unique_id_hash_code = unique_id_hash_code; |
| 68 #if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) |
| 69 int32_t completing_id_hash_code; |
| 70 if (!iter->ReadInt(&completing_id_hash_code)) |
| 71 return false; |
| 72 p->completing_id_hash_code = completing_id_hash_code; |
| 73 #endif |
| 74 |
| 75 return true; |
| 76 } |
| 77 |
| 78 void ParamTraits<net::MutablePartialNetworkTrafficAnnotationTag>::Log( |
| 79 const param_type& p, |
| 80 std::string* l) { |
| 81 l->append("("); |
| 82 LogParam(p.unique_id_hash_code, l); |
| 83 #if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) |
| 84 l->append(", "); |
| 85 LogParam(p.completing_id_hash_code, l); |
| 86 #endif |
| 87 l->append(")"); |
| 88 } |
| 89 |
| 90 } // namespace IPC |
| OLD | NEW |