Chromium Code Reviews| 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 #ifdef ANDROID | |
| 8 #include "base/android/java_thread.h" | |
| 9 #endif | |
|
benm (inactive)
2013/07/10 16:50:06
I think conditional includes go at the bottom in a
Kristian Monsen
2013/07/10 17:50:19
You are right, did not know this :-) Makes the log
| |
| 7 #include "base/bind.h" | 10 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #ifndef ANDROID | |
| 9 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #endif | |
| 10 #include "content/browser/renderer_host/java/java_bridge_channel_host.h" | 15 #include "content/browser/renderer_host/java/java_bridge_channel_host.h" |
| 11 #include "content/browser/renderer_host/render_view_host_impl.h" | 16 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 12 #include "content/child/child_process.h" | 17 #include "content/child/child_process.h" |
| 13 #include "content/child/npobject_stub.h" | 18 #include "content/child/npobject_stub.h" |
| 14 #include "content/child/npobject_util.h" // For CreateNPVariantParam() | 19 #include "content/child/npobject_util.h" // For CreateNPVariantParam() |
| 15 #include "content/common/java_bridge_messages.h" | 20 #include "content/common/java_bridge_messages.h" |
| 16 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 18 #include "third_party/WebKit/public/web/WebBindings.h" | 23 #include "third_party/WebKit/public/web/WebBindings.h" |
| 19 | 24 |
| 25 #ifdef ANDROID | |
| 26 #define THREAD base::android::JavaThread | |
| 27 #else | |
| 28 #define THREAD base::Thread | |
| 29 #endif | |
| 30 | |
| 20 namespace content { | 31 namespace content { |
| 21 | 32 |
| 22 namespace { | 33 namespace { |
| 23 class JavaBridgeThread : public base::Thread { | 34 class JavaBridgeThread : public THREAD { |
| 24 public: | 35 public: |
| 25 JavaBridgeThread() : base::Thread("JavaBridge") { | 36 JavaBridgeThread() : THREAD("JavaBridge") { |
| 26 Start(); | 37 Start(); |
| 27 } | 38 } |
| 28 virtual ~JavaBridgeThread() { | 39 virtual ~JavaBridgeThread() { |
| 29 Stop(); | 40 Stop(); |
| 30 } | 41 } |
| 31 }; | 42 }; |
| 32 | 43 |
| 33 void CleanUpStubs(const std::vector<base::WeakPtr<NPObjectStub> > & stubs) { | 44 void CleanUpStubs(const std::vector<base::WeakPtr<NPObjectStub> > & stubs) { |
| 34 for (size_t i = 0; i < stubs.size(); ++i) { | 45 for (size_t i = 0; i < stubs.size(); ++i) { |
| 35 if (stubs[i]) { | 46 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. | 169 // functionality. The page URL is also not required. |
| 159 stubs_.push_back((new NPObjectStub( | 170 stubs_.push_back((new NPObjectStub( |
| 160 object, channel_.get(), route_id, 0, GURL()))->AsWeakPtr()); | 171 object, channel_.get(), route_id, 0, GURL()))->AsWeakPtr()); |
| 161 | 172 |
| 162 // The NPObjectStub takes a reference to the NPObject. Release the ref added | 173 // The NPObjectStub takes a reference to the NPObject. Release the ref added |
| 163 // in CreateNPVariantParam(). | 174 // in CreateNPVariantParam(). |
| 164 WebKit::WebBindings::releaseObject(object); | 175 WebKit::WebBindings::releaseObject(object); |
| 165 } | 176 } |
| 166 | 177 |
| 167 } // namespace content | 178 } // namespace content |
| OLD | NEW |