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..1c09327d9bfdb6c7b2308000514e9e3d0f677ec5 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); |
} |
+ScopedRefNPObject::ScopedRefNPObject() : object_(NULL) { } |
+ |
+ScopedRefNPObject::~ScopedRefNPObject() { |
+ *this = NULL; |
+} |
+ |
+ScopedRefNPObject& ScopedRefNPObject::operator=(NPObject* object) { |
+ if (object) { |
+ g_npnetscape_funcs->retainobject(object); |
+ } |
+ if (object_) { |
+ g_npnetscape_funcs->releaseobject(object_); |
+ } |
+ object_ = object; |
+ return *this; |
+} |
+ |
} // namespace remoting |