Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: ppapi/proxy/serialized_var.cc

Issue 6823016: Create a VarPrivate interface to contain the scripting helper functions of Var. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/ppapi_cpp.gypi ('k') | webkit/plugins/ppapi/npapi_glue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ppapi/proxy/serialized_var.h" 5 #include "ppapi/proxy/serialized_var.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ipc/ipc_message_utils.h" 8 #include "ipc/ipc_message_utils.h"
9 #include "ppapi/proxy/dispatcher.h" 9 #include "ppapi/proxy/dispatcher.h"
10 #include "ppapi/proxy/interface_proxy.h" 10 #include "ppapi/proxy/interface_proxy.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // TODO(brettw) in the case of an invalid string ID, it would be nice 140 // TODO(brettw) in the case of an invalid string ID, it would be nice
141 // to send something to the other side such that a 0 ID would be 141 // to send something to the other side such that a 0 ID would be
142 // generated there. Then the function implementing the interface can 142 // generated there. Then the function implementing the interface can
143 // handle the invalid string as if it was in process rather than seeing 143 // handle the invalid string as if it was in process rather than seeing
144 // what looks like a valid empty string. 144 // what looks like a valid empty string.
145 m->WriteString(string_value_); 145 m->WriteString(string_value_);
146 break; 146 break;
147 case PP_VARTYPE_OBJECT: 147 case PP_VARTYPE_OBJECT:
148 m->WriteInt64(var_.value.as_id); 148 m->WriteInt64(var_.value.as_id);
149 break; 149 break;
150 case PP_VARTYPE_ARRAY:
151 case PP_VARTYPE_DICTIONARY:
152 // TODO(brettw) when these are supported, implement this.
153 NOTIMPLEMENTED();
154 break;
150 } 155 }
151 } 156 }
152 157
153 bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m, void** iter) { 158 bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m, void** iter) {
154 #ifndef NDEBUG 159 #ifndef NDEBUG
155 // We should only deserialize something once or will end up with leaked 160 // We should only deserialize something once or will end up with leaked
156 // references. 161 // references.
157 // 162 //
158 // One place this has happened in the past is using 163 // One place this has happened in the past is using
159 // std::vector<SerializedVar>.resize(). If you're doing this manually instead 164 // std::vector<SerializedVar>.resize(). If you're doing this manually instead
(...skipping 29 matching lines...) Expand all
189 case PP_VARTYPE_DOUBLE: 194 case PP_VARTYPE_DOUBLE:
190 success = IPC::ParamTraits<double>::Read(m, iter, &var_.value.as_double); 195 success = IPC::ParamTraits<double>::Read(m, iter, &var_.value.as_double);
191 break; 196 break;
192 case PP_VARTYPE_STRING: 197 case PP_VARTYPE_STRING:
193 success = m->ReadString(iter, &string_value_); 198 success = m->ReadString(iter, &string_value_);
194 var_.value.as_id = 0; 199 var_.value.as_id = 0;
195 break; 200 break;
196 case PP_VARTYPE_OBJECT: 201 case PP_VARTYPE_OBJECT:
197 success = m->ReadInt64(iter, &var_.value.as_id); 202 success = m->ReadInt64(iter, &var_.value.as_id);
198 break; 203 break;
204 case PP_VARTYPE_ARRAY:
205 case PP_VARTYPE_DICTIONARY:
206 // TODO(brettw) when these types are supported, implement this.
207 NOTIMPLEMENTED();
208 break;
199 default: 209 default:
200 // Leave success as false. 210 // Leave success as false.
201 break; 211 break;
202 } 212 }
203 213
204 // All success cases get here. We avoid writing the type above so that the 214 // All success cases get here. We avoid writing the type above so that the
205 // output param is untouched (defaults to VARTYPE_UNDEFINED) even in the 215 // output param is untouched (defaults to VARTYPE_UNDEFINED) even in the
206 // failure case. 216 // failure case.
207 if (success) 217 if (success)
208 var_.type = static_cast<PP_VarType>(type); 218 var_.type = static_cast<PP_VarType>(type);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 *inner_->GetStringPtr() = str; 527 *inner_->GetStringPtr() = str;
518 } 528 }
519 529
520 SerializedVarTestReader::SerializedVarTestReader(const SerializedVar& var) 530 SerializedVarTestReader::SerializedVarTestReader(const SerializedVar& var)
521 : SerializedVar(var) { 531 : SerializedVar(var) {
522 } 532 }
523 533
524 } // namespace proxy 534 } // namespace proxy
525 } // namespace pp 535 } // namespace pp
526 536
OLDNEW
« no previous file with comments | « ppapi/ppapi_cpp.gypi ('k') | webkit/plugins/ppapi/npapi_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698