OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/message_channel.h" | 5 #include "webkit/plugins/ppapi/message_channel.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return false; | 78 return false; |
79 } | 79 } |
80 const std::string& value = string->value(); | 80 const std::string& value = string->value(); |
81 // TODO(dmichael): We should consider caching the V8 string in the host- | 81 // TODO(dmichael): We should consider caching the V8 string in the host- |
82 // side StringVar, so that we only have to convert/copy once if a | 82 // side StringVar, so that we only have to convert/copy once if a |
83 // string is sent more than once. | 83 // string is sent more than once. |
84 *result = v8::String::New(value.c_str(), value.size()); | 84 *result = v8::String::New(value.c_str(), value.size()); |
85 break; | 85 break; |
86 } | 86 } |
87 case PP_VARTYPE_OBJECT: | 87 case PP_VARTYPE_OBJECT: |
88 // Objects are not currently supported. | 88 case PP_VARTYPE_ARRAY: |
| 89 case PP_VARTYPE_DICTIONARY: |
| 90 case PP_VARTYPE_ARRAY_BUFFER: |
| 91 // These are not currently supported. |
89 NOTIMPLEMENTED(); | 92 NOTIMPLEMENTED(); |
90 result->Clear(); | 93 result->Clear(); |
91 return false; | 94 return false; |
92 default: | |
93 result->Clear(); | |
94 return false; | |
95 } | 95 } |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 // Copy a PP_Var in to a PP_Var that is appropriate for sending via postMessage. | 99 // Copy a PP_Var in to a PP_Var that is appropriate for sending via postMessage. |
100 // This currently just copies the value. For a string Var, the result is a | 100 // This currently just copies the value. For a string Var, the result is a |
101 // PP_Var with the a copy of |var|'s string contents and a reference count of 1. | 101 // PP_Var with the a copy of |var|'s string contents and a reference count of 1. |
102 // | 102 // |
103 // TODO(dmichael): We need to do structured clone eventually to copy a object | 103 // TODO(dmichael): We need to do structured clone eventually to copy a object |
104 // structure. The details and PPAPI changes for this are TBD. | 104 // structure. The details and PPAPI changes for this are TBD. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // SetPassthroughObject(passthrough_object()); | 381 // SetPassthroughObject(passthrough_object()); |
382 if (passthrough_object_) | 382 if (passthrough_object_) |
383 WebBindings::releaseObject(passthrough_object_); | 383 WebBindings::releaseObject(passthrough_object_); |
384 | 384 |
385 passthrough_object_ = passthrough; | 385 passthrough_object_ = passthrough; |
386 } | 386 } |
387 | 387 |
388 } // namespace ppapi | 388 } // namespace ppapi |
389 } // namespace webkit | 389 } // namespace webkit |
390 | 390 |
OLD | NEW |