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

Side by Side Diff: content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" 5 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_helper.h" 8 #include "base/android/jni_helper.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/browser/renderer_host/java/java_bound_object.h" 13 #include "content/browser/renderer_host/java/java_bound_object.h"
14 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host.h" 14 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host.h"
15 #include "content/common/android/hash_set.h" 15 #include "content/common/android/hash_set.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "third_party/WebKit/public/web/WebBindings.h" 17 #include "third_party/WebKit/public/web/WebBindings.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 JavaBridgeDispatcherHostManager::JavaBridgeDispatcherHostManager( 21 JavaBridgeDispatcherHostManager::JavaBridgeDispatcherHostManager(
22 WebContents* web_contents) 22 WebContents* web_contents)
23 : WebContentsObserver(web_contents) { 23 : WebContentsObserver(web_contents) {
24 } 24 }
25 25
26 JavaBridgeDispatcherHostManager::~JavaBridgeDispatcherHostManager() { 26 JavaBridgeDispatcherHostManager::~JavaBridgeDispatcherHostManager() {
27 for (ObjectMap::iterator iter = objects_.begin(); iter != objects_.end(); 27 for (ObjectMap::iterator iter = objects_.begin(); iter != objects_.end();
28 ++iter) { 28 ++iter) {
29 WebKit::WebBindings::releaseObject(iter->second); 29 blink::WebBindings::releaseObject(iter->second);
30 } 30 }
31 DCHECK_EQ(0U, instances_.size()); 31 DCHECK_EQ(0U, instances_.size());
32 } 32 }
33 33
34 void JavaBridgeDispatcherHostManager::AddNamedObject(const string16& name, 34 void JavaBridgeDispatcherHostManager::AddNamedObject(const string16& name,
35 NPObject* object) { 35 NPObject* object) {
36 // Record this object in a map so that we can add it into RenderViewHosts 36 // Record this object in a map so that we can add it into RenderViewHosts
37 // created later. The JavaBridgeDispatcherHost instances will take a 37 // created later. The JavaBridgeDispatcherHost instances will take a
38 // reference to the object, but we take one too, because this method can be 38 // reference to the object, but we take one too, because this method can be
39 // called before there are any such instances. 39 // called before there are any such instances.
40 WebKit::WebBindings::retainObject(object); 40 blink::WebBindings::retainObject(object);
41 objects_[name] = object; 41 objects_[name] = object;
42 42
43 for (InstanceMap::iterator iter = instances_.begin(); 43 for (InstanceMap::iterator iter = instances_.begin();
44 iter != instances_.end(); ++iter) { 44 iter != instances_.end(); ++iter) {
45 iter->second->AddNamedObject(name, object); 45 iter->second->AddNamedObject(name, object);
46 } 46 }
47 } 47 }
48 48
49 void JavaBridgeDispatcherHostManager::SetRetainedObjectSet( 49 void JavaBridgeDispatcherHostManager::SetRetainedObjectSet(
50 const JavaObjectWeakGlobalRef& retained_object_set) { 50 const JavaObjectWeakGlobalRef& retained_object_set) {
(...skipping 15 matching lines...) Expand all
66 retained_object_set_ = retained_object_set; 66 retained_object_set_ = retained_object_set;
67 } 67 }
68 } 68 }
69 69
70 void JavaBridgeDispatcherHostManager::RemoveNamedObject(const string16& name) { 70 void JavaBridgeDispatcherHostManager::RemoveNamedObject(const string16& name) {
71 ObjectMap::iterator iter = objects_.find(name); 71 ObjectMap::iterator iter = objects_.find(name);
72 if (iter == objects_.end()) { 72 if (iter == objects_.end()) {
73 return; 73 return;
74 } 74 }
75 75
76 WebKit::WebBindings::releaseObject(iter->second); 76 blink::WebBindings::releaseObject(iter->second);
77 objects_.erase(iter); 77 objects_.erase(iter);
78 78
79 for (InstanceMap::iterator iter = instances_.begin(); 79 for (InstanceMap::iterator iter = instances_.begin();
80 iter != instances_.end(); ++iter) { 80 iter != instances_.end(); ++iter) {
81 iter->second->RemoveNamedObject(name); 81 iter->second->RemoveNamedObject(name);
82 } 82 }
83 } 83 }
84 84
85 void JavaBridgeDispatcherHostManager::OnGetChannelHandle( 85 void JavaBridgeDispatcherHostManager::OnGetChannelHandle(
86 RenderViewHost* render_view_host, IPC::Message* reply_msg) { 86 RenderViewHost* render_view_host, IPC::Message* reply_msg) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 JNIEnv* env = base::android::AttachCurrentThread(); 148 JNIEnv* env = base::android::AttachCurrentThread();
149 base::android::ScopedJavaLocalRef<jobject> retained_object_set = 149 base::android::ScopedJavaLocalRef<jobject> retained_object_set =
150 retained_object_set_.get(env); 150 retained_object_set_.get(env);
151 if (!retained_object_set.is_null()) { 151 if (!retained_object_set.is_null()) {
152 JNI_Java_HashSet_remove(env, retained_object_set, object); 152 JNI_Java_HashSet_remove(env, retained_object_set, object);
153 } 153 }
154 } 154 }
155 155
156 } // namespace content 156 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698