1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/android/java/java_bridge_thread.h"
7 #include "base/lazy_instance.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/task_runner_util.h"
11 #if !defined(OS_ANDROID)
12 #error "JavaBridge only supports OS_ANDROID"
19 base::LazyInstance
<JavaBridgeThread
> g_background_thread
=
20 LAZY_INSTANCE_INITIALIZER
;
24 JavaBridgeThread::JavaBridgeThread()
25 : base::android::JavaHandlerThread("JavaBridge") {
29 JavaBridgeThread::~JavaBridgeThread() {
34 bool JavaBridgeThread::CurrentlyOn() {
35 return base::MessageLoop::current() ==
36 g_background_thread
.Get().message_loop();
40 base::TaskRunner
* JavaBridgeThread::GetTaskRunner() {
41 return g_background_thread
.Get().message_loop()->task_runner().get();
44 } // namespace content