OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 CppVariant exists primarily as an interface between C++ callers and the | 35 CppVariant exists primarily as an interface between C++ callers and the |
36 corresponding NPVariant type. CppVariant also provides a number of | 36 corresponding NPVariant type. CppVariant also provides a number of |
37 convenience constructors and accessors, so that the NPVariantType values | 37 convenience constructors and accessors, so that the NPVariantType values |
38 don't need to be exposed, and a destructor to free any memory allocated for | 38 don't need to be exposed, and a destructor to free any memory allocated for |
39 string values. | 39 string values. |
40 */ | 40 */ |
41 | 41 |
42 #ifndef CppVariant_h | 42 #ifndef CppVariant_h |
43 #define CppVariant_h | 43 #define CppVariant_h |
44 | 44 |
| 45 #include "public/platform/WebNonCopyable.h" |
45 #include "public/web/WebBindings.h" | 46 #include "public/web/WebBindings.h" |
46 #include <string> | 47 #include <string> |
47 #include <vector> | 48 #include <vector> |
48 | 49 |
49 namespace WebTestRunner { | 50 namespace WebTestRunner { |
50 | 51 |
51 class CppVariant : public NPVariant { | 52 class CppVariant : public NPVariant, public WebKit::WebNonCopyable { |
52 public: | 53 public: |
53 CppVariant(); | 54 CppVariant(); |
54 ~CppVariant(); | 55 ~CppVariant(); |
55 void setNull(); | 56 void setNull(); |
56 void set(bool); | 57 void set(bool); |
57 void set(int32_t); | 58 void set(int32_t); |
58 void set(double); | 59 void set(double); |
59 | 60 |
60 // Note that setting a CppVariant to a string value involves copying the | 61 // Note that setting a CppVariant to a string value involves copying the |
61 // string data, which must be freed with a call to freeData() when the | 62 // string data, which must be freed with a call to freeData() when the |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // invoked. Returns whether the method was successfully invoked. If the | 136 // invoked. Returns whether the method was successfully invoked. If the |
136 // method was invoked successfully, any return value is stored in the | 137 // method was invoked successfully, any return value is stored in the |
137 // CppVariant specified by result. | 138 // CppVariant specified by result. |
138 bool invokeDefault(const CppVariant* arguments, | 139 bool invokeDefault(const CppVariant* arguments, |
139 uint32_t argumentCount, CppVariant& result) const; | 140 uint32_t argumentCount, CppVariant& result) const; |
140 }; | 141 }; |
141 | 142 |
142 } | 143 } |
143 | 144 |
144 #endif // CppVariant_h | 145 #endif // CppVariant_h |
OLD | NEW |