OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/nullable_string16.h" | 10 #include "base/nullable_string16.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // On POSIX, we log to stdout, which we assume can display ASCII. | 36 // On POSIX, we log to stdout, which we assume can display ASCII. |
37 static const size_t kMaxBytesToLog = 100; | 37 static const size_t kMaxBytesToLog = 100; |
38 for (size_t i = 0; i < std::min(data.size(), kMaxBytesToLog); ++i) { | 38 for (size_t i = 0; i < std::min(data.size(), kMaxBytesToLog); ++i) { |
39 if (isprint(data[i])) | 39 if (isprint(data[i])) |
40 out->push_back(data[i]); | 40 out->push_back(data[i]); |
41 else | 41 else |
42 out->append( | 42 out->append( |
43 base::StringPrintf("[%02X]", static_cast<unsigned char>(data[i]))); | 43 base::StringPrintf("[%02X]", static_cast<unsigned char>(data[i]))); |
44 } | 44 } |
45 if (data.size() > kMaxBytesToLog) { | 45 if (data.size() > kMaxBytesToLog) { |
46 out->append( | 46 out->append(base::StringPrintf( |
47 base::StringPrintf(" and %u more bytes", | 47 " and %u more bytes", |
48 static_cast<unsigned>(data.size() - kMaxBytesToLog))); | 48 static_cast<unsigned>(data.size() - kMaxBytesToLog))); |
49 } | 49 } |
50 #endif | 50 #endif |
51 } | 51 } |
52 | 52 |
53 bool ReadValue(const Message* m, PickleIterator* iter, Value** value, | 53 bool ReadValue(const Message* m, PickleIterator* iter, Value** value, |
54 int recursion); | 54 int recursion); |
55 | 55 |
56 void WriteValue(Message* m, const Value* value, int recursion) { | 56 void WriteValue(Message* m, const Value* value, int recursion) { |
57 bool result; | 57 bool result; |
58 if (recursion > kMaxRecursionDepth) { | 58 if (recursion > kMaxRecursionDepth) { |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 return result; | 818 return result; |
819 } | 819 } |
820 | 820 |
821 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 821 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
822 l->append("<MSG>"); | 822 l->append("<MSG>"); |
823 } | 823 } |
824 | 824 |
825 #endif // OS_WIN | 825 #endif // OS_WIN |
826 | 826 |
827 } // namespace IPC | 827 } // namespace IPC |
OLD | NEW |