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

Unified Diff: ios/web/web_thread_impl.cc

Issue 1942053002: Deletes base::MessageLoop::set_thread_name(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: uses PlatformThread::GetName Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/app/web_main_loop.mm ('k') | remoting/base/auto_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_thread_impl.cc
diff --git a/ios/web/web_thread_impl.cc b/ios/web/web_thread_impl.cc
index 38f4a33ac3ee76c6912e5a568be897214de3d0c3..e371cd8c5a54813397437fd1da794a36bca2abe9 100644
--- a/ios/web/web_thread_impl.cc
+++ b/ios/web/web_thread_impl.cc
@@ -33,6 +33,12 @@ const char* const g_web_thread_names[WebThread::ID_COUNT] = {
"Web_IOThread", // IO
};
+static const char* GetThreadName(WebThread::ID thread) {
+ if (WebThread::UI <= thread && thread < WebThread::ID_COUNT)
+ return g_web_thread_names[thread];
+ return "Unknown Thread";
+}
+
// An implementation of SingleThreadTaskRunner to be used in conjunction
// with WebThread.
class WebThreadTaskRunner : public base::SingleThreadTaskRunner {
@@ -110,12 +116,12 @@ base::LazyInstance<WebThreadGlobals>::Leaky g_globals =
} // namespace
WebThreadImpl::WebThreadImpl(ID identifier)
- : Thread(g_web_thread_names[identifier]), identifier_(identifier) {
+ : Thread(GetThreadName(identifier)), identifier_(identifier) {
Initialize();
}
WebThreadImpl::WebThreadImpl(ID identifier, base::MessageLoop* message_loop)
- : Thread(message_loop->thread_name()), identifier_(identifier) {
+ : Thread(GetThreadName(identifier)), identifier_(identifier) {
set_message_loop(message_loop);
Initialize();
}
@@ -371,22 +377,12 @@ bool WebThread::CurrentlyOn(ID identifier) {
base::MessageLoop::current();
}
-static const char* GetThreadName(WebThread::ID thread) {
- if (WebThread::UI <= thread && thread < WebThread::ID_COUNT)
- return g_web_thread_names[thread];
- return "Unknown Thread";
-}
-
// static
std::string WebThread::GetDCheckCurrentlyOnErrorMessage(ID expected) {
- const base::MessageLoop* message_loop = base::MessageLoop::current();
- ID actual_web_thread;
- const char* actual_name = "Unknown Thread";
- if (message_loop && !message_loop->thread_name().empty()) {
- actual_name = message_loop->thread_name().c_str();
- } else if (GetCurrentThreadIdentifier(&actual_web_thread)) {
- actual_name = GetThreadName(actual_web_thread);
- }
+ std::string actual_name = base::PlatformThread::GetName();
+ if (actual_name.empty())
+ actual_name = "Unknown Thread";
+
std::string result = "Must be called on ";
result += GetThreadName(expected);
result += "; actually called on ";
« no previous file with comments | « ios/web/app/web_main_loop.mm ('k') | remoting/base/auto_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698