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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 2808343004: android: Fix java launcher thread (Closed)
Patch Set: Created 3 years, 8 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 | « content/browser/android/launcher_thread.cc ('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/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 break; 1061 break;
1062 case BrowserThread::PROCESS_LAUNCHER: 1062 case BrowserThread::PROCESS_LAUNCHER:
1063 TRACE_EVENT_BEGIN1("startup", 1063 TRACE_EVENT_BEGIN1("startup",
1064 "BrowserMainLoop::CreateThreads:start", 1064 "BrowserMainLoop::CreateThreads:start",
1065 "Thread", "BrowserThread::PROCESS_LAUNCHER"); 1065 "Thread", "BrowserThread::PROCESS_LAUNCHER");
1066 #if defined(OS_ANDROID) 1066 #if defined(OS_ANDROID)
1067 // Android specializes Launcher thread so it is accessible in java. 1067 // Android specializes Launcher thread so it is accessible in java.
1068 // Note Android never does clean shutdown, so shutdown use-after-free 1068 // Note Android never does clean shutdown, so shutdown use-after-free
1069 // concerns are not a problem in practice. 1069 // concerns are not a problem in practice.
1070 redirect_thread = false; 1070 redirect_thread = false;
1071 message_loop = android::LauncherThread::GetMessageLoop(); 1071 message_loop = android::LauncherThread::GetMessageLoop();
gab 2017/04/13 15:40:04 DCHECK(message_loop); here maybe?
boliu 2017/04/13 16:30:05 Done.
1072 #endif 1072 #endif
1073 if (redirect_thread) { 1073 if (redirect_thread) {
1074 non_ui_non_io_task_runner_traits 1074 non_ui_non_io_task_runner_traits
1075 .WithPriority(base::TaskPriority::USER_BLOCKING) 1075 .WithPriority(base::TaskPriority::USER_BLOCKING)
1076 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); 1076 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN);
1077 } else { 1077 } else {
1078 thread_to_start = &process_launcher_thread_; 1078 thread_to_start = &process_launcher_thread_;
1079 options.timer_slack = base::TIMER_SLACK_MAXIMUM; 1079 options.timer_slack = base::TIMER_SLACK_MAXIMUM;
1080 } 1080 }
1081 break; 1081 break;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 NOTREACHED(); 1120 NOTREACHED();
1121 break; 1121 break;
1122 } 1122 }
1123 1123
1124 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); 1124 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id);
1125 1125
1126 if (thread_to_start) { 1126 if (thread_to_start) {
1127 (*thread_to_start) 1127 (*thread_to_start)
1128 .reset(message_loop ? new BrowserProcessSubThread(id, message_loop) 1128 .reset(message_loop ? new BrowserProcessSubThread(id, message_loop)
1129 : new BrowserProcessSubThread(id)); 1129 : new BrowserProcessSubThread(id));
1130 if (!(*thread_to_start)->StartWithOptions(options)) 1130 if (!message_loop && !(*thread_to_start)->StartWithOptions(options))
gab 2017/04/13 15:39:12 Ah I see, hadn't parsed that this wasn't about add
boliu 2017/04/13 16:30:05 Done.
1131 LOG(FATAL) << "Failed to start the browser thread: id == " << id; 1131 LOG(FATAL) << "Failed to start the browser thread: id == " << id;
1132 } else { 1132 } else {
1133 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner = 1133 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner =
1134 base::CreateSingleThreadTaskRunnerWithTraits( 1134 base::CreateSingleThreadTaskRunnerWithTraits(
1135 non_ui_non_io_task_runner_traits); 1135 non_ui_non_io_task_runner_traits);
1136 DCHECK(redirection_task_runner); 1136 DCHECK(redirection_task_runner);
1137 BrowserThreadImpl::RedirectThreadIDToTaskRunner( 1137 BrowserThreadImpl::RedirectThreadIDToTaskRunner(
1138 id, std::move(redirection_task_runner)); 1138 id, std::move(redirection_task_runner));
1139 } 1139 }
1140 1140
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 1765 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
1766 MediaInternals::GetInstance()); 1766 MediaInternals::GetInstance());
1767 } 1767 }
1768 CHECK(audio_manager_); 1768 CHECK(audio_manager_);
1769 1769
1770 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 1770 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
1771 CHECK(audio_system_); 1771 CHECK(audio_system_);
1772 } 1772 }
1773 1773
1774 } // namespace content 1774 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/launcher_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698