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

Side by Side Diff: content/browser/renderer_host/java/java_bound_object.h

Issue 18570003: Move Renderer-side NPObject owner tracking to JavaBridgeChannel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move some comment cleanup to crrev.com/17428003 Created 7 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 16 matching lines...) Expand all
27 // Interrogation of the Java object for its methods is done lazily. This class 27 // Interrogation of the Java object for its methods is done lazily. This class
28 // is not generally threadsafe. However, it does allow for instances to be 28 // is not generally threadsafe. However, it does allow for instances to be
29 // created and destroyed on different threads. 29 // created and destroyed on different threads.
30 class JavaBoundObject { 30 class JavaBoundObject {
31 public: 31 public:
32 // Takes a Java object and creates a JavaBoundObject around it. The 32 // Takes a Java object and creates a JavaBoundObject around it. The
33 // |require_annotation| flag specifies whether or not only methods with the 33 // |require_annotation| flag specifies whether or not only methods with the
34 // JavascriptInterface annotation are exposed to JavaScript. This property 34 // JavascriptInterface annotation are exposed to JavaScript. This property
35 // propagates to all Objects that get implicitly exposed as return values as 35 // propagates to all Objects that get implicitly exposed as return values as
36 // well. Returns an NPObject with a ref count of one which owns the 36 // well. Returns an NPObject with a ref count of one which owns the
37 // JavaBoundObject. 37 // JavaBoundObject. The object is marked as owned by |owner|.
38 // See also comment below for |manager_|. 38 // See also comment below for |manager_|.
39 static NPObject* Create( 39 static NPObject* Create(
40 struct _NPP* owner,
joth 2013/07/02 20:49:03 I thought in C++ it's fine to just declare this as
Wez 2013/07/02 21:05:09 Yes. However, the NPAPI headers typedef struct _NP
40 const base::android::JavaRef<jobject>& object, 41 const base::android::JavaRef<jobject>& object,
41 const base::android::JavaRef<jclass>& safe_annotation_clazz, 42 const base::android::JavaRef<jclass>& safe_annotation_clazz,
42 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager); 43 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager);
43 44
44 virtual ~JavaBoundObject(); 45 virtual ~JavaBoundObject();
45 46
46 // Gets a local ref to the underlying JavaObject from a JavaBoundObject 47 // Gets a local ref to the underlying JavaObject from a JavaBoundObject
47 // wrapped as an NPObject. May return null if the underlying object has 48 // wrapped as an NPObject. May return null if the underlying object has
48 // been garbage collected. 49 // been garbage collected.
49 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject( 50 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject(
(...skipping 30 matching lines...) Expand all
80 mutable bool are_methods_set_up_; 81 mutable bool are_methods_set_up_;
81 82
82 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_; 83 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_;
83 84
84 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); 85 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject);
85 }; 86 };
86 87
87 } // namespace content 88 } // namespace content
88 89
89 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ 90 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/browser/renderer_host/java/java_bound_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698