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

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

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 | « no previous file | remoting/host/plugin/host_plugin_utils.cc » ('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 #ifndef REMOTING_HOST_PLUGIN_HOST_PLUGIN_UTILS_H_ 5 #ifndef REMOTING_HOST_PLUGIN_HOST_PLUGIN_UTILS_H_
6 #define REMOTING_HOST_PLUGIN_HOST_PLUGIN_UTILS_H_ 6 #define REMOTING_HOST_PLUGIN_HOST_PLUGIN_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "third_party/npapi/bindings/npapi.h" 10 #include "third_party/npapi/bindings/npapi.h"
(...skipping 18 matching lines...) Expand all
29 29
30 // Convert an NPVariant into an NSPObject. 30 // Convert an NPVariant into an NSPObject.
31 NPObject* ObjectFromNPVariant(const NPVariant& variant); 31 NPObject* ObjectFromNPVariant(const NPVariant& variant);
32 32
33 // Scoped reference pointer for NPObjects. All objects using this class 33 // Scoped reference pointer for NPObjects. All objects using this class
34 // must be owned by g_npnetscape_funcs. 34 // must be owned by g_npnetscape_funcs.
35 class ScopedRefNPObject { 35 class ScopedRefNPObject {
36 public: 36 public:
37 ScopedRefNPObject(); 37 ScopedRefNPObject();
38 explicit ScopedRefNPObject(NPObject* object); 38 explicit ScopedRefNPObject(NPObject* object);
39 explicit ScopedRefNPObject(const ScopedRefNPObject& object);
39 ~ScopedRefNPObject(); 40 ~ScopedRefNPObject();
40 41
41 // Release the held reference and replace it with |object|, incrementing 42 // Release the held reference and replace it with |object|, incrementing
42 // its reference count. 43 // its reference count.
43 ScopedRefNPObject& operator=(NPObject* object); 44 ScopedRefNPObject& operator=(NPObject* object);
45 ScopedRefNPObject& operator=(const ScopedRefNPObject& object);
44 46
45 NPObject* get() { return object_; } 47 NPObject* get() const { return object_; }
46 48
47 private: 49 private:
48 NPObject* object_; 50 NPObject* object_;
49
50 DISALLOW_COPY_AND_ASSIGN(ScopedRefNPObject);
51 }; 51 };
52 52
53 } // namespace remoting 53 } // namespace remoting
54 54
55 #endif // REMOTING_HOST_PLUGIN_HOST_PLUGIN_UTILS_H_ 55 #endif // REMOTING_HOST_PLUGIN_HOST_PLUGIN_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/plugin/host_plugin_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698