OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_PLUGINS_PPAPI_VAR_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_VAR_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_VAR_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_VAR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Returns a NPIdentifier that corresponds to the given PP_Var. The contents | 47 // Returns a NPIdentifier that corresponds to the given PP_Var. The contents |
48 // of the PP_Var will be copied. Returns 0 if the given PP_Var is not a a | 48 // of the PP_Var will be copied. Returns 0 if the given PP_Var is not a a |
49 // string or integer type. | 49 // string or integer type. |
50 static NPIdentifier PPVarToNPIdentifier(PP_Var var); | 50 static NPIdentifier PPVarToNPIdentifier(PP_Var var); |
51 | 51 |
52 // Returns a PP_Var corresponding to the given identifier. In the case of | 52 // Returns a PP_Var corresponding to the given identifier. In the case of |
53 // a string identifier, the string will be allocated associated with the | 53 // a string identifier, the string will be allocated associated with the |
54 // given module. A returned string will have a reference count of 1. | 54 // given module. A returned string will have a reference count of 1. |
55 static PP_Var NPIdentifierToPPVar(PluginModule* module, NPIdentifier id); | 55 static PP_Var NPIdentifierToPPVar(PluginModule* module, NPIdentifier id); |
56 | 56 |
| 57 // Returns a string representing the given var for logging purposes. |
| 58 static std::string PPVarToLogString(PP_Var var); |
| 59 |
57 // Provides access to the manual refcounting of a PP_Var from the plugin's | 60 // Provides access to the manual refcounting of a PP_Var from the plugin's |
58 // perspective. This is different than the AddRef/Release on this scoped | 61 // perspective. This is different than the AddRef/Release on this scoped |
59 // object. This uses the ResourceTracker, which keeps a separate "plugin | 62 // object. This uses the ResourceTracker, which keeps a separate "plugin |
60 // refcount" that prevents the plugin from messing up our refcounting or | 63 // refcount" that prevents the plugin from messing up our refcounting or |
61 // freeing something out from under us. | 64 // freeing something out from under us. |
62 // | 65 // |
63 // You should not generally need to use these functions. However, if you | 66 // You should not generally need to use these functions. However, if you |
64 // call a plugin function that returns a var, it will transfer a ref to us | 67 // call a plugin function that returns a var, it will transfer a ref to us |
65 // (the caller) which in the case of a string or object var will need to | 68 // (the caller) which in the case of a string or object var will need to |
66 // be released. | 69 // be released. |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 bool has_exception_; | 275 bool has_exception_; |
273 | 276 |
274 // May be null if the consumer isn't interesting in catching exceptions. | 277 // May be null if the consumer isn't interesting in catching exceptions. |
275 PP_Var* exception_; | 278 PP_Var* exception_; |
276 }; | 279 }; |
277 | 280 |
278 } // namespace ppapi | 281 } // namespace ppapi |
279 } // namespace webkit | 282 } // namespace webkit |
280 | 283 |
281 #endif // WEBKIT_PLUGINS_PPAPI_VAR_H_ | 284 #endif // WEBKIT_PLUGINS_PPAPI_VAR_H_ |
OLD | NEW |