| OLD | NEW |
| 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.h" | 5 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "content/browser/renderer_host/java/java_bridge_channel_host.h" | 10 #include "content/browser/renderer_host/java/java_bridge_channel_host.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 FROM_HERE, | 122 FROM_HERE, |
| 123 base::Bind(&JavaBridgeDispatcherHost::CreateObjectStub, this, object, | 123 base::Bind(&JavaBridgeDispatcherHost::CreateObjectStub, this, object, |
| 124 route_id)); | 124 route_id)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void JavaBridgeDispatcherHost::CreateObjectStub(NPObject* object, | 127 void JavaBridgeDispatcherHost::CreateObjectStub(NPObject* object, |
| 128 int route_id) { | 128 int route_id) { |
| 129 DCHECK_EQ(g_background_thread.Get().message_loop(), MessageLoop::current()); | 129 DCHECK_EQ(g_background_thread.Get().message_loop(), MessageLoop::current()); |
| 130 if (!channel_) { | 130 if (!channel_) { |
| 131 channel_ = JavaBridgeChannelHost::GetJavaBridgeChannelHost( | 131 channel_ = JavaBridgeChannelHost::GetJavaBridgeChannelHost( |
| 132 render_view_host()->process()->GetID(), | 132 render_view_host()->GetProcess()->GetID(), |
| 133 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 133 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 // NPObjectStub takes a ref to the NPObject. The lifetime of the NPObjectStub | 136 // NPObjectStub takes a ref to the NPObject. The lifetime of the NPObjectStub |
| 137 // is governed by that of the NPObjectProxy in the renderer, via the channel. | 137 // is governed by that of the NPObjectProxy in the renderer, via the channel. |
| 138 // Pass 0 for the containing window, as it's only used by plugins to pump the | 138 // Pass 0 for the containing window, as it's only used by plugins to pump the |
| 139 // window message queue when a method on a renderer-side object causes a | 139 // window message queue when a method on a renderer-side object causes a |
| 140 // dialog to be displayed, and the Java Bridge does not need this | 140 // dialog to be displayed, and the Java Bridge does not need this |
| 141 // functionality. The page URL is also not required. | 141 // functionality. The page URL is also not required. |
| 142 new NPObjectStub(object, channel_, route_id, 0, GURL()); | 142 new NPObjectStub(object, channel_, route_id, 0, GURL()); |
| 143 // The NPObjectStub takes a reference to the NPObject. Release the ref added | 143 // The NPObjectStub takes a reference to the NPObject. Release the ref added |
| 144 // in CreateNPVariantParam(). | 144 // in CreateNPVariantParam(). |
| 145 WebKit::WebBindings::releaseObject(object); | 145 WebKit::WebBindings::releaseObject(object); |
| 146 } | 146 } |
| OLD | NEW |