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

Side by Side Diff: content/browser/android/java/gin_java_bound_object.cc

Issue 772123002: [Android] Java Bridge: handle requests from Java Script on the background thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed benm's comment Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/android/java/gin_java_bound_object.h" 5 #include "content/browser/android/java/gin_java_bound_object.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 24 matching lines...) Expand all
35 GinJavaBoundObject* GinJavaBoundObject::CreateNamed( 35 GinJavaBoundObject* GinJavaBoundObject::CreateNamed(
36 const JavaObjectWeakGlobalRef& ref, 36 const JavaObjectWeakGlobalRef& ref,
37 const base::android::JavaRef<jclass>& safe_annotation_clazz) { 37 const base::android::JavaRef<jclass>& safe_annotation_clazz) {
38 return new GinJavaBoundObject(ref, safe_annotation_clazz); 38 return new GinJavaBoundObject(ref, safe_annotation_clazz);
39 } 39 }
40 40
41 // static 41 // static
42 GinJavaBoundObject* GinJavaBoundObject::CreateTransient( 42 GinJavaBoundObject* GinJavaBoundObject::CreateTransient(
43 const JavaObjectWeakGlobalRef& ref, 43 const JavaObjectWeakGlobalRef& ref,
44 const base::android::JavaRef<jclass>& safe_annotation_clazz, 44 const base::android::JavaRef<jclass>& safe_annotation_clazz,
45 RenderFrameHost* holder) { 45 int32 holder) {
46 std::set<RenderFrameHost*> holders; 46 std::set<int32> holders;
47 holders.insert(holder); 47 holders.insert(holder);
48 return new GinJavaBoundObject(ref, safe_annotation_clazz, holders); 48 return new GinJavaBoundObject(ref, safe_annotation_clazz, holders);
49 } 49 }
50 50
51 GinJavaBoundObject::GinJavaBoundObject( 51 GinJavaBoundObject::GinJavaBoundObject(
52 const JavaObjectWeakGlobalRef& ref, 52 const JavaObjectWeakGlobalRef& ref,
53 const base::android::JavaRef<jclass>& safe_annotation_clazz) 53 const base::android::JavaRef<jclass>& safe_annotation_clazz)
54 : ref_(ref), 54 : ref_(ref),
55 names_count_(1), 55 names_count_(1),
56 object_get_class_method_id_(NULL), 56 object_get_class_method_id_(NULL),
57 are_methods_set_up_(false), 57 are_methods_set_up_(false),
58 safe_annotation_clazz_(safe_annotation_clazz) { 58 safe_annotation_clazz_(safe_annotation_clazz) {
59 } 59 }
60 60
61 GinJavaBoundObject::GinJavaBoundObject( 61 GinJavaBoundObject::GinJavaBoundObject(
62 const JavaObjectWeakGlobalRef& ref, 62 const JavaObjectWeakGlobalRef& ref,
63 const base::android::JavaRef<jclass>& safe_annotation_clazz, 63 const base::android::JavaRef<jclass>& safe_annotation_clazz,
64 const std::set<RenderFrameHost*> holders) 64 const std::set<int32> holders)
65 : ref_(ref), 65 : ref_(ref),
66 names_count_(0), 66 names_count_(0),
67 holders_(holders), 67 holders_(holders),
68 object_get_class_method_id_(NULL), 68 object_get_class_method_id_(NULL),
69 are_methods_set_up_(false), 69 are_methods_set_up_(false),
70 safe_annotation_clazz_(safe_annotation_clazz) { 70 safe_annotation_clazz_(safe_annotation_clazz) {
71 } 71 }
72 72
73 GinJavaBoundObject::~GinJavaBoundObject() { 73 GinJavaBoundObject::~GinJavaBoundObject() {
74 } 74 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (!safe) 183 if (!safe)
184 continue; 184 continue;
185 } 185 }
186 186
187 JavaMethod* method = new JavaMethod(java_method); 187 JavaMethod* method = new JavaMethod(java_method);
188 methods_.insert(std::make_pair(method->name(), make_linked_ptr(method))); 188 methods_.insert(std::make_pair(method->name(), make_linked_ptr(method)));
189 } 189 }
190 } 190 }
191 191
192 } // namespace content 192 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698