Index: remoting/host/plugin/host_plugin_utils.h |
diff --git a/remoting/host/plugin/host_plugin_utils.h b/remoting/host/plugin/host_plugin_utils.h |
index 363da4f99a596869b541568728a7633d570189a5..b53e104a3e65591d4f1bc230c8b8309fb4b1ec94 100644 |
--- a/remoting/host/plugin/host_plugin_utils.h |
+++ b/remoting/host/plugin/host_plugin_utils.h |
@@ -30,6 +30,25 @@ NPVariant NPVariantFromString(const std::string& val); |
// Convert an NPVariant into an NSPObject. |
NPObject* ObjectFromNPVariant(const NPVariant& variant); |
+// Scoped reference pointer for NPObjects. All objects using this class |
+// must be owned by g_npnetscape_funcs. |
+class ScopedRefNPObject { |
+ public: |
+ ScopedRefNPObject(); |
+ ~ScopedRefNPObject(); |
+ |
+ // Release the held reference and replace it with |object|, incrementing |
+ // its reference count. |
+ ScopedRefNPObject& operator=(NPObject* object); |
Sergey Ulanov
2011/08/30 17:36:51
FYI: Operator overloading is prohibited by code st
|
+ |
+ NPObject* get() { return object_; } |
+ |
+ private: |
+ NPObject* object_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedRefNPObject); |
+}; |
+ |
} // namespace remoting |
#endif // REMOTING_HOST_PLUGIN_HOST_PLUGIN_UTILS_H_ |