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

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

Issue 11235068: Move the remaning files in content\common to the content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 #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"
11 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
12 #include "content/common/child_process.h" 12 #include "content/common/child_process.h"
13 #include "content/common/java_bridge_messages.h" 13 #include "content/common/java_bridge_messages.h"
14 #include "content/common/npobject_stub.h" 14 #include "content/common/npobject_stub.h"
15 #include "content/common/npobject_util.h" // For CreateNPVariantParam() 15 #include "content/common/npobject_util.h" // For CreateNPVariantParam()
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
19 19
20 using content::BrowserThread; 20 using content::BrowserThread;
21 using content::NPObjectStub;
22 using content::NPVariant_Param;
21 using content::RenderViewHost; 23 using content::RenderViewHost;
22 24
23 namespace { 25 namespace {
24 class JavaBridgeThread : public base::Thread { 26 class JavaBridgeThread : public base::Thread {
25 public: 27 public:
26 JavaBridgeThread() : base::Thread("JavaBridge") { 28 JavaBridgeThread() : base::Thread("JavaBridge") {
27 Start(); 29 Start();
28 } 30 }
29 virtual ~JavaBridgeThread() { 31 virtual ~JavaBridgeThread() {
30 Stop(); 32 Stop();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // that is where Java objects will live, and CreateNPVariantParam() needs the 109 // that is where Java objects will live, and CreateNPVariantParam() needs the
108 // channel to create the NPObjectStub. To avoid blocking here until the 110 // channel to create the NPObjectStub. To avoid blocking here until the
109 // channel is ready, create the NPVariant_Param by hand, then post a message 111 // channel is ready, create the NPVariant_Param by hand, then post a message
110 // to the background thread to set up the channel and create the corresponding 112 // to the background thread to set up the channel and create the corresponding
111 // NPObjectStub. Post that message before doing any IPC, to make sure that 113 // NPObjectStub. Post that message before doing any IPC, to make sure that
112 // the channel and object proxies are ready before responses are received 114 // the channel and object proxies are ready before responses are received
113 // from the renderer. 115 // from the renderer.
114 116
115 // Create an NPVariantParam suitable for serialization over IPC from our 117 // Create an NPVariantParam suitable for serialization over IPC from our
116 // NPVariant. See CreateNPVariantParam() in npobject_utils. 118 // NPVariant. See CreateNPVariantParam() in npobject_utils.
117 param->type = NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID; 119 param->type = content::NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID;
118 int route_id = JavaBridgeChannelHost::ThreadsafeGenerateRouteID(); 120 int route_id = JavaBridgeChannelHost::ThreadsafeGenerateRouteID();
119 param->npobject_routing_id = route_id; 121 param->npobject_routing_id = route_id;
120 122
121 WebKit::WebBindings::retainObject(object); 123 WebKit::WebBindings::retainObject(object);
122 g_background_thread.Get().message_loop()->PostTask( 124 g_background_thread.Get().message_loop()->PostTask(
123 FROM_HERE, 125 FROM_HERE,
124 base::Bind(&JavaBridgeDispatcherHost::CreateObjectStub, this, object, 126 base::Bind(&JavaBridgeDispatcherHost::CreateObjectStub, this, object,
125 route_id)); 127 route_id));
126 } 128 }
127 129
(...skipping 10 matching lines...) Expand all
138 // is governed by that of the NPObjectProxy in the renderer, via the channel. 140 // is governed by that of the NPObjectProxy in the renderer, via the channel.
139 // Pass 0 for the containing window, as it's only used by plugins to pump the 141 // Pass 0 for the containing window, as it's only used by plugins to pump the
140 // window message queue when a method on a renderer-side object causes a 142 // window message queue when a method on a renderer-side object causes a
141 // dialog to be displayed, and the Java Bridge does not need this 143 // dialog to be displayed, and the Java Bridge does not need this
142 // functionality. The page URL is also not required. 144 // functionality. The page URL is also not required.
143 new NPObjectStub(object, channel_, route_id, 0, GURL()); 145 new NPObjectStub(object, channel_, route_id, 0, GURL());
144 // The NPObjectStub takes a reference to the NPObject. Release the ref added 146 // The NPObjectStub takes a reference to the NPObject. Release the ref added
145 // in CreateNPVariantParam(). 147 // in CreateNPVariantParam().
146 WebKit::WebBindings::releaseObject(object); 148 WebKit::WebBindings::releaseObject(object);
147 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698