Chromium Code Reviews| 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 #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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 /// | 250 /// |
| 251 /// Example: | 251 /// Example: |
| 252 /// void FooBar(a, b, Var* exception = NULL) { | 252 /// void FooBar(a, b, Var* exception = NULL) { |
| 253 /// foo_interface->Bar(a, b, Var::OutException(exception).get()); | 253 /// foo_interface->Bar(a, b, Var::OutException(exception).get()); |
| 254 /// } | 254 /// } |
| 255 class OutException { | 255 class OutException { |
| 256 public: | 256 public: |
| 257 /// A constructor. | 257 /// A constructor. |
| 258 OutException(Var* v) | 258 OutException(Var* v) |
| 259 : output_(v), | 259 : output_(v), |
| 260 originally_had_exception_(v && v->is_null()) { | 260 originally_had_exception_(v && !v->is_undefined()) { |
|
brettw
2011/08/04 23:10:50
It sucks this is in two places, I filed http://cod
| |
| 261 if (output_) { | 261 if (output_) { |
| 262 temp_ = output_->var_; | 262 temp_ = output_->var_; |
| 263 } else { | 263 } else { |
| 264 temp_.padding = 0; | 264 temp_.padding = 0; |
| 265 temp_.type = PP_VARTYPE_UNDEFINED; | 265 temp_.type = PP_VARTYPE_UNDEFINED; |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 /// Destructor. | 269 /// Destructor. |
| 270 ~OutException() { | 270 ~OutException() { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 292 // Prevent an arbitrary pointer argument from being implicitly converted to | 292 // Prevent an arbitrary pointer argument from being implicitly converted to |
| 293 // a bool at Var construction. If somebody makes such a mistake, (s)he will | 293 // a bool at Var construction. If somebody makes such a mistake, (s)he will |
| 294 // get a compilation error. | 294 // get a compilation error. |
| 295 Var(void* non_scriptable_object_pointer); | 295 Var(void* non_scriptable_object_pointer); |
| 296 | 296 |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 } // namespace pp | 299 } // namespace pp |
| 300 | 300 |
| 301 #endif // PPAPI_CPP_VAR_H_ | 301 #endif // PPAPI_CPP_VAR_H_ |
| OLD | NEW |