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

Side by Side Diff: ppapi/cpp/var.h

Issue 8502030: Draft of a PPAPI interface for ArrayBuffer and typed arrays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years 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
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 #ifndef PPAPI_CPP_VAR_H_ 5 #ifndef PPAPI_CPP_VAR_H_
6 #define PPAPI_CPP_VAR_H_ 6 #define PPAPI_CPP_VAR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 /// This function determines if this <code>Var</code> is a number. 152 /// This function determines if this <code>Var</code> is a number.
153 /// 153 ///
154 /// @return true if this <code>Var</code> is an int32 or double number, 154 /// @return true if this <code>Var</code> is an int32 or double number,
155 /// otherwise false. 155 /// otherwise false.
156 bool is_number() const { 156 bool is_number() const {
157 return var_.type == PP_VARTYPE_INT32 || 157 return var_.type == PP_VARTYPE_INT32 ||
158 var_.type == PP_VARTYPE_DOUBLE; 158 var_.type == PP_VARTYPE_DOUBLE;
159 } 159 }
160 160
161 /// This function determines if this <code>Var</code> is an ArrayBuffer.
162 bool is_array_buffer() const { return var_.type == PP_VARTYPE_ARRAY_BUFFER; }
163
161 /// AsBool() converts this <code>Var</code> to a bool. Assumes the 164 /// AsBool() converts this <code>Var</code> to a bool. Assumes the
162 /// internal representation is_bool(). If it's not, it will assert in debug 165 /// internal representation is_bool(). If it's not, it will assert in debug
163 /// mode, and return false. 166 /// mode, and return false.
164 /// 167 ///
165 /// @return A bool version of this <code>Var</code>. 168 /// @return A bool version of this <code>Var</code>.
166 bool AsBool() const; 169 bool AsBool() const;
167 170
168 /// AsInt() converts this <code>Var</code> to an int32_t. This function 171 /// AsInt() converts this <code>Var</code> to an int32_t. This function
169 /// is required because JavaScript doesn't have a concept of ints and doubles, 172 /// is required because JavaScript doesn't have a concept of ints and doubles,
170 /// only numbers. The distinction between the two is an optimization inside 173 /// only numbers. The distinction between the two is an optimization inside
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 private: 292 private:
290 // Prevent an arbitrary pointer argument from being implicitly converted to 293 // Prevent an arbitrary pointer argument from being implicitly converted to
291 // a bool at Var construction. If somebody makes such a mistake, (s)he will 294 // a bool at Var construction. If somebody makes such a mistake, (s)he will
292 // get a compilation error. 295 // get a compilation error.
293 Var(void* non_scriptable_object_pointer); 296 Var(void* non_scriptable_object_pointer);
294 }; 297 };
295 298
296 } // namespace pp 299 } // namespace pp
297 300
298 #endif // PPAPI_CPP_VAR_H_ 301 #endif // PPAPI_CPP_VAR_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/var_array_buffer_dev.cc ('k') | ppapi/native_client/src/shared/ppapi_proxy/object_serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698