Index: remoting/host/plugin/host_plugin_utils.cc |
diff --git a/remoting/host/plugin/host_plugin_utils.cc b/remoting/host/plugin/host_plugin_utils.cc |
index f8e36bdc1f82faad9260be7116487a3aa0ad8610..deb13c85ee1ada176448b4016748db1cab0a8844 100644 |
--- a/remoting/host/plugin/host_plugin_utils.cc |
+++ b/remoting/host/plugin/host_plugin_utils.cc |
@@ -40,4 +40,21 @@ NPObject* ObjectFromNPVariant(const NPVariant& variant) { |
return NPVARIANT_TO_OBJECT(variant); |
} |
+scoped_NPObject::scoped_NPObject() : object_(NULL) { } |
+ |
+scoped_NPObject::~scoped_NPObject() { |
+ replace(NULL); |
+} |
+ |
+void scoped_NPObject::replace(NPObject* object) { |
+ if (object_) { |
+ g_npnetscape_funcs->releaseobject(object_); |
+ } |
+ object_ = object; |
+ if (object_) { |
+ g_npnetscape_funcs->retainobject(object_); |
+ } |
+} |
+ |
+ |
} // namespace remoting |