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

Side by Side Diff: content/browser/android/java/java_bridge_thread.cc

Issue 2123653003: Remove calls to MessageLoop::current() in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « no previous file | content/browser/appcache/appcache_request_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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/android/java/java_bridge_thread.h" 5 #include "content/browser/android/java/java_bridge_thread.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/single_thread_task_runner.h"
9 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 12
12 #if !defined(OS_ANDROID) 13 #if !defined(OS_ANDROID)
13 #error "JavaBridge only supports OS_ANDROID" 14 #error "JavaBridge only supports OS_ANDROID"
14 #endif 15 #endif
15 16
16 namespace content { 17 namespace content {
17 18
18 namespace { 19 namespace {
19 20
20 base::LazyInstance<JavaBridgeThread> g_background_thread = 21 base::LazyInstance<JavaBridgeThread> g_background_thread =
21 LAZY_INSTANCE_INITIALIZER; 22 LAZY_INSTANCE_INITIALIZER;
22 23
23 } // namespace 24 } // namespace
24 25
25 JavaBridgeThread::JavaBridgeThread() 26 JavaBridgeThread::JavaBridgeThread()
26 : base::android::JavaHandlerThread("JavaBridge") { 27 : base::android::JavaHandlerThread("JavaBridge") {
27 Start(); 28 Start();
28 } 29 }
29 30
30 JavaBridgeThread::~JavaBridgeThread() { 31 JavaBridgeThread::~JavaBridgeThread() {
31 Stop(); 32 Stop();
32 } 33 }
33 34
34 // static 35 // static
35 bool JavaBridgeThread::CurrentlyOn() { 36 bool JavaBridgeThread::CurrentlyOn() {
36 return base::MessageLoop::current() == 37 return g_background_thread.Get()
37 g_background_thread.Get().message_loop(); 38 .message_loop()
39 ->task_runner()
40 ->BelongsToCurrentThread();
38 } 41 }
39 42
40 // static 43 // static
41 base::TaskRunner* JavaBridgeThread::GetTaskRunner() { 44 base::TaskRunner* JavaBridgeThread::GetTaskRunner() {
42 return g_background_thread.Get().message_loop()->task_runner().get(); 45 return g_background_thread.Get().message_loop()->task_runner().get();
43 } 46 }
44 47
45 } // namespace content 48 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/appcache/appcache_request_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698