| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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 "chrome/common/webkit_param_traits.h" | |
| 6 | |
| 7 #include "base/format_macros.h" | |
| 8 | |
| 9 namespace IPC { | |
| 10 | |
| 11 void ParamTraits<WebKit::WebCache::ResourceTypeStat>::Log( | |
| 12 const param_type& p, std::string* l) { | |
| 13 l->append(base::StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS " %" PRIuS, | |
| 14 p.count, p.size, p.liveSize, p.decodedSize)); | |
| 15 } | |
| 16 | |
| 17 void ParamTraits<WebKit::WebTextCheckingResult>::Write(Message* m, | |
| 18 const param_type& p) { | |
| 19 WriteParam(m, static_cast<int>(p.error)); | |
| 20 WriteParam(m, p.position); | |
| 21 WriteParam(m, p.length); | |
| 22 } | |
| 23 | |
| 24 bool ParamTraits<WebKit::WebTextCheckingResult>::Read(const Message* m, | |
| 25 void** iter, | |
| 26 param_type* p) { | |
| 27 int error = 0; | |
| 28 if (!ReadParam(m, iter, &error)) | |
| 29 return false; | |
| 30 if (error != WebKit::WebTextCheckingResult::ErrorSpelling && | |
| 31 error != WebKit::WebTextCheckingResult::ErrorGrammar) | |
| 32 return false; | |
| 33 int position = 0; | |
| 34 if (!ReadParam(m, iter, &position)) | |
| 35 return false; | |
| 36 int length = 0; | |
| 37 if (!ReadParam(m, iter, &length)) | |
| 38 return false; | |
| 39 | |
| 40 *p = WebKit::WebTextCheckingResult( | |
| 41 static_cast<WebKit::WebTextCheckingResult::Error>(error), | |
| 42 position, | |
| 43 length); | |
| 44 return true; | |
| 45 } | |
| 46 | |
| 47 void ParamTraits<WebKit::WebTextCheckingResult>::Log(const param_type& p, | |
| 48 std::string* l) { | |
| 49 l->append("("); | |
| 50 LogParam(static_cast<int>(p.error), l); | |
| 51 l->append(", "); | |
| 52 LogParam(p.position, l); | |
| 53 l->append(", "); | |
| 54 LogParam(p.length, l); | |
| 55 l->append(")"); | |
| 56 } | |
| 57 | |
| 58 } // namespace IPC | |
| OLD | NEW |