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

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

Issue 2808343004: android: Fix java launcher thread (Closed)
Patch Set: review comments 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
1072 DCHECK(message_loop);
1072 #endif 1073 #endif
1073 if (redirect_thread) { 1074 if (redirect_thread) {
1074 non_ui_non_io_task_runner_traits 1075 non_ui_non_io_task_runner_traits
1075 .WithPriority(base::TaskPriority::USER_BLOCKING) 1076 .WithPriority(base::TaskPriority::USER_BLOCKING)
1076 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); 1077 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN);
1077 } else { 1078 } else {
1078 thread_to_start = &process_launcher_thread_; 1079 thread_to_start = &process_launcher_thread_;
1079 options.timer_slack = base::TIMER_SLACK_MAXIMUM; 1080 options.timer_slack = base::TIMER_SLACK_MAXIMUM;
1080 } 1081 }
1081 break; 1082 break;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 NOTREACHED(); 1121 NOTREACHED();
1121 break; 1122 break;
1122 } 1123 }
1123 1124
1124 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); 1125 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id);
1125 1126
1126 if (thread_to_start) { 1127 if (thread_to_start) {
1127 (*thread_to_start) 1128 (*thread_to_start)
1128 .reset(message_loop ? new BrowserProcessSubThread(id, message_loop) 1129 .reset(message_loop ? new BrowserProcessSubThread(id, message_loop)
1129 : new BrowserProcessSubThread(id)); 1130 : new BrowserProcessSubThread(id));
1130 if (!(*thread_to_start)->StartWithOptions(options)) 1131 // Start the thread if an existing |message_loop| wasn't provided.
1132 if (!message_loop && !(*thread_to_start)->StartWithOptions(options))
1131 LOG(FATAL) << "Failed to start the browser thread: id == " << id; 1133 LOG(FATAL) << "Failed to start the browser thread: id == " << id;
1132 } else { 1134 } else {
1133 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner = 1135 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner =
1134 base::CreateSingleThreadTaskRunnerWithTraits( 1136 base::CreateSingleThreadTaskRunnerWithTraits(
1135 non_ui_non_io_task_runner_traits); 1137 non_ui_non_io_task_runner_traits);
1136 DCHECK(redirection_task_runner); 1138 DCHECK(redirection_task_runner);
1137 BrowserThreadImpl::RedirectThreadIDToTaskRunner( 1139 BrowserThreadImpl::RedirectThreadIDToTaskRunner(
1138 id, std::move(redirection_task_runner)); 1140 id, std::move(redirection_task_runner));
1139 } 1141 }
1140 1142
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 1759 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
1758 MediaInternals::GetInstance()); 1760 MediaInternals::GetInstance());
1759 } 1761 }
1760 CHECK(audio_manager_); 1762 CHECK(audio_manager_);
1761 1763
1762 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 1764 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
1763 CHECK(audio_system_); 1765 CHECK(audio_system_);
1764 } 1766 }
1765 1767
1766 } // namespace content 1768 } // 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