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

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

Issue 18584006: Making a way to create thread with a Java Looper for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fixes, and make the waitable event a stack variable 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
« base/android/java_thread.cc ('K') | « base/base.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
10 #include "content/browser/renderer_host/java/java_bridge_channel_host.h" 9 #include "content/browser/renderer_host/java/java_bridge_channel_host.h"
11 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
12 #include "content/child/child_process.h" 11 #include "content/child/child_process.h"
13 #include "content/child/npobject_stub.h" 12 #include "content/child/npobject_stub.h"
14 #include "content/child/npobject_util.h" // For CreateNPVariantParam() 13 #include "content/child/npobject_util.h" // For CreateNPVariantParam()
15 #include "content/common/java_bridge_messages.h" 14 #include "content/common/java_bridge_messages.h"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
18 #include "third_party/WebKit/public/web/WebBindings.h" 17 #include "third_party/WebKit/public/web/WebBindings.h"
19 18
19 #if defined(OS_ANDROID)
20 #include "base/android/java_thread.h"
benm (inactive) 2013/07/17 10:52:29 nit, maybe a comment here to say that we require a
Kristian Monsen 2013/07/17 21:02:37 Sure, will add a comment. I don't think it is just
21 #else
22 #include "base/threading/thread.h"
23 #endif
24
25
26 #if defined(OS_ANDROID)
27 typedef base::android::JavaThread THREAD;
28 #else
29 typedef base::Thread THREAD;
30 #endif
31
20 namespace content { 32 namespace content {
21 33
22 namespace { 34 namespace {
23 class JavaBridgeThread : public base::Thread { 35 class JavaBridgeThread : public THREAD {
24 public: 36 public:
25 JavaBridgeThread() : base::Thread("JavaBridge") { 37 JavaBridgeThread() : THREAD("JavaBridge") {
26 Start(); 38 Start();
27 } 39 }
28 virtual ~JavaBridgeThread() { 40 virtual ~JavaBridgeThread() {
29 Stop(); 41 Stop();
30 } 42 }
31 }; 43 };
32 44
33 void CleanUpStubs(const std::vector<base::WeakPtr<NPObjectStub> > & stubs) { 45 void CleanUpStubs(const std::vector<base::WeakPtr<NPObjectStub> > & stubs) {
34 for (size_t i = 0; i < stubs.size(); ++i) { 46 for (size_t i = 0; i < stubs.size(); ++i) {
35 if (stubs[i]) { 47 if (stubs[i]) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // functionality. The page URL is also not required. 170 // functionality. The page URL is also not required.
159 stubs_.push_back((new NPObjectStub( 171 stubs_.push_back((new NPObjectStub(
160 object, channel_.get(), route_id, 0, GURL()))->AsWeakPtr()); 172 object, channel_.get(), route_id, 0, GURL()))->AsWeakPtr());
161 173
162 // The NPObjectStub takes a reference to the NPObject. Release the ref added 174 // The NPObjectStub takes a reference to the NPObject. Release the ref added
163 // in CreateNPVariantParam(). 175 // in CreateNPVariantParam().
164 WebKit::WebBindings::releaseObject(object); 176 WebKit::WebBindings::releaseObject(object);
165 } 177 }
166 178
167 } // namespace content 179 } // namespace content
OLDNEW
« base/android/java_thread.cc ('K') | « base/base.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698