OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/nullable_string16.h" | 9 #include "base/nullable_string16.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 static void WriteValue(Message* m, const Value* value, int recursion) { | 29 static void WriteValue(Message* m, const Value* value, int recursion) { |
30 if (recursion > kMaxRecursionDepth) { | 30 if (recursion > kMaxRecursionDepth) { |
31 LOG(WARNING) << "Max recursion depth hit in WriteValue."; | 31 LOG(WARNING) << "Max recursion depth hit in WriteValue."; |
32 return; | 32 return; |
33 } | 33 } |
34 | 34 |
35 m->WriteInt(value->GetType()); | 35 m->WriteInt(value->GetType()); |
36 | 36 |
37 switch (value->GetType()) { | 37 switch (value->GetType()) { |
38 case Value::TYPE_NULL: | 38 case Value::TYPE_NULL: |
39 break; | 39 break; |
40 case Value::TYPE_BOOLEAN: { | 40 case Value::TYPE_BOOLEAN: { |
41 bool val; | 41 bool val; |
42 value->GetAsBoolean(&val); | 42 value->GetAsBoolean(&val); |
43 WriteParam(m, val); | 43 WriteParam(m, val); |
44 break; | 44 break; |
45 } | 45 } |
46 case Value::TYPE_INTEGER: { | 46 case Value::TYPE_INTEGER: { |
47 int val; | 47 int val; |
48 value->GetAsInteger(&val); | 48 value->GetAsInteger(&val); |
49 WriteParam(m, val); | 49 WriteParam(m, val); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 for (size_t i = 0; i < list->GetSize(); ++i) { | 89 for (size_t i = 0; i < list->GetSize(); ++i) { |
90 Value* subval; | 90 Value* subval; |
91 if (list->Get(i, &subval)) { | 91 if (list->Get(i, &subval)) { |
92 WriteValue(m, subval, recursion + 1); | 92 WriteValue(m, subval, recursion + 1); |
93 } else { | 93 } else { |
94 NOTREACHED() << "ListValue::GetSize is a filthy liar."; | 94 NOTREACHED() << "ListValue::GetSize is a filthy liar."; |
95 } | 95 } |
96 } | 96 } |
97 break; | 97 break; |
98 } | 98 } |
| 99 case Value::TYPE_PATH: { |
| 100 FilePath path; |
| 101 value->GetAsFilePath(&path); |
| 102 WriteParam(m, path); |
| 103 break; |
| 104 } |
99 } | 105 } |
100 } | 106 } |
101 | 107 |
102 // Helper for ReadValue that reads a DictionaryValue into a pre-allocated | 108 // Helper for ReadValue that reads a DictionaryValue into a pre-allocated |
103 // object. | 109 // object. |
104 static bool ReadDictionaryValue(const Message* m, void** iter, | 110 static bool ReadDictionaryValue(const Message* m, void** iter, |
105 DictionaryValue* value, int recursion) { | 111 DictionaryValue* value, int recursion) { |
106 int size; | 112 int size; |
107 if (!ReadParam(m, iter, &size)) | 113 if (!ReadParam(m, iter, &size)) |
108 return false; | 114 return false; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 ReadParam(m, iter, &r->flags) && | 469 ReadParam(m, iter, &r->flags) && |
464 ReadParam(m, iter, &r->sent) && | 470 ReadParam(m, iter, &r->sent) && |
465 ReadParam(m, iter, &r->receive) && | 471 ReadParam(m, iter, &r->receive) && |
466 ReadParam(m, iter, &r->dispatch) && | 472 ReadParam(m, iter, &r->dispatch) && |
467 ReadParam(m, iter, &r->params); | 473 ReadParam(m, iter, &r->params); |
468 r->type = static_cast<uint16>(type); | 474 r->type = static_cast<uint16>(type); |
469 return result; | 475 return result; |
470 } | 476 } |
471 | 477 |
472 } // namespace IPC | 478 } // namespace IPC |
OLD | NEW |