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 "ppapi/shared_impl/var.h" | 5 #include "ppapi/shared_impl/var.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 else | 49 else |
50 result = string->value(); | 50 result = string->value(); |
51 | 51 |
52 std::string null; | 52 std::string null; |
53 null.push_back(0); | 53 null.push_back(0); |
54 ReplaceSubstringsAfterOffset(&result, 0, null, "\\0"); | 54 ReplaceSubstringsAfterOffset(&result, 0, null, "\\0"); |
55 return result; | 55 return result; |
56 } | 56 } |
57 case PP_VARTYPE_OBJECT: | 57 case PP_VARTYPE_OBJECT: |
58 return "[Object]"; | 58 return "[Object]"; |
| 59 case PP_VARTYPE_ARRAY: |
| 60 return "[Array]"; |
| 61 case PP_VARTYPE_DICTIONARY: |
| 62 return "[Dictionary]"; |
| 63 case PP_VARTYPE_ARRAY_BUFFER: |
| 64 return "[Array buffer]"; |
59 default: | 65 default: |
60 return "[Invalid var]"; | 66 return "[Invalid var]"; |
61 } | 67 } |
62 } | 68 } |
63 | 69 |
64 StringVar* Var::AsStringVar() { | 70 StringVar* Var::AsStringVar() { |
65 return NULL; | 71 return NULL; |
66 } | 72 } |
67 | 73 |
68 ArrayBufferVar* Var::AsArrayBufferVar() { | 74 ArrayBufferVar* Var::AsArrayBufferVar() { |
69 return NULL; | 75 return NULL; |
70 } | 76 } |
71 | 77 |
72 NPObjectVar* Var::AsNPObjectVar() { | 78 NPObjectVar* Var::AsNPObjectVar() { |
73 return NULL; | 79 return NULL; |
74 } | 80 } |
75 | 81 |
76 ProxyObjectVar* Var::AsProxyObjectVar() { | 82 ProxyObjectVar* Var::AsProxyObjectVar() { |
77 return NULL; | 83 return NULL; |
78 } | 84 } |
79 | 85 |
| 86 DictionaryVar* Var::AsDictionaryVar() { |
| 87 return NULL; |
| 88 } |
| 89 |
80 PP_Var Var::GetPPVar() { | 90 PP_Var Var::GetPPVar() { |
81 int32 id = GetOrCreateVarID(); | 91 int32 id = GetOrCreateVarID(); |
82 if (!id) | 92 if (!id) |
83 return PP_MakeNull(); | 93 return PP_MakeNull(); |
84 | 94 |
85 PP_Var result; | 95 PP_Var result; |
86 result.type = GetType(); | 96 result.type = GetType(); |
87 result.padding = 0; | 97 result.padding = 0; |
88 result.value.as_id = id; | 98 result.value.as_id = id; |
89 return result; | 99 return result; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return NULL; | 198 return NULL; |
189 scoped_refptr<Var> var_object( | 199 scoped_refptr<Var> var_object( |
190 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); | 200 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); |
191 if (!var_object) | 201 if (!var_object) |
192 return NULL; | 202 return NULL; |
193 return var_object->AsArrayBufferVar(); | 203 return var_object->AsArrayBufferVar(); |
194 } | 204 } |
195 | 205 |
196 } // namespace ppapi | 206 } // namespace ppapi |
197 | 207 |
OLD | NEW |