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" | |
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 #ifdef ANDROID | |
joth
2013/07/10 20:33:48
#if defined(OS_ANDROID)
although this entire file
Kristian Monsen
2013/07/16 21:54:41
Will remove the #ifdef after renaming the folder t
| |
20 #include "base/android/java_thread.h" | |
21 #else | |
22 #include "base/threading/thread.h" | |
23 #endif | |
24 | |
25 | |
26 #ifdef ANDROID | |
27 #define THREAD base::android::JavaThread | |
28 #else | |
29 #define THREAD base::Thread | |
joth
2013/07/10 20:33:48
typedef is nicer (but I'd not use the ifdef at all
Kristian Monsen
2013/07/16 21:54:41
Done.
| |
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 Loading... | |
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 |
OLD | NEW |