Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1098)

Side by Side Diff: remoting/host/plugin/host_plugin_utils.cc

Issue 10024025: Use ScopedRefNPObject to pass NPObjects in the host plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/plugin/host_plugin_utils.h ('k') | remoting/host/plugin/host_script_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "remoting/host/plugin/host_plugin_utils.h" 5 #include "remoting/host/plugin/host_plugin_utils.h"
6 6
7 namespace remoting { 7 namespace remoting {
8 8
9 NPNetscapeFuncs* g_npnetscape_funcs = NULL; 9 NPNetscapeFuncs* g_npnetscape_funcs = NULL;
10 10
(...skipping 29 matching lines...) Expand all
40 return NPVARIANT_TO_OBJECT(variant); 40 return NPVARIANT_TO_OBJECT(variant);
41 } 41 }
42 42
43 ScopedRefNPObject::ScopedRefNPObject() : object_(NULL) { } 43 ScopedRefNPObject::ScopedRefNPObject() : object_(NULL) { }
44 44
45 ScopedRefNPObject::ScopedRefNPObject(NPObject* object) 45 ScopedRefNPObject::ScopedRefNPObject(NPObject* object)
46 : object_(NULL) { 46 : object_(NULL) {
47 *this = object; 47 *this = object;
48 } 48 }
49 49
50 ScopedRefNPObject::ScopedRefNPObject(const ScopedRefNPObject& object)
51 : object_(NULL) {
52 *this = object.get();
Wez 2012/04/09 20:00:50 nit: Do you need get() here, since there's an oper
Sergey Ulanov 2012/04/09 20:06:32 Done.
53 }
54
50 ScopedRefNPObject::~ScopedRefNPObject() { 55 ScopedRefNPObject::~ScopedRefNPObject() {
51 *this = NULL; 56 *this = NULL;
52 } 57 }
53 58
54 ScopedRefNPObject& ScopedRefNPObject::operator=(NPObject* object) { 59 ScopedRefNPObject& ScopedRefNPObject::operator=(NPObject* object) {
55 if (object) { 60 if (object) {
56 g_npnetscape_funcs->retainobject(object); 61 g_npnetscape_funcs->retainobject(object);
57 } 62 }
58 if (object_) { 63 if (object_) {
59 g_npnetscape_funcs->releaseobject(object_); 64 g_npnetscape_funcs->releaseobject(object_);
60 } 65 }
61 object_ = object; 66 object_ = object;
62 return *this; 67 return *this;
63 } 68 }
64 69
70 ScopedRefNPObject& ScopedRefNPObject::operator=(
71 const ScopedRefNPObject& object) {
72 return *this = object.get();
73 }
74
65 } // namespace remoting 75 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/plugin/host_plugin_utils.h ('k') | remoting/host/plugin/host_script_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698