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

Side by Side 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: fixes mac/ios build 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ios/web/web_thread_impl.h" 5 #include "ios/web/web_thread_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 LAZY_INSTANCE_INITIALIZER; 108 LAZY_INSTANCE_INITIALIZER;
109 109
110 } // namespace 110 } // namespace
111 111
112 WebThreadImpl::WebThreadImpl(ID identifier) 112 WebThreadImpl::WebThreadImpl(ID identifier)
113 : Thread(g_web_thread_names[identifier]), identifier_(identifier) { 113 : Thread(g_web_thread_names[identifier]), identifier_(identifier) {
114 Initialize(); 114 Initialize();
115 } 115 }
116 116
117 WebThreadImpl::WebThreadImpl(ID identifier, base::MessageLoop* message_loop) 117 WebThreadImpl::WebThreadImpl(ID identifier, base::MessageLoop* message_loop)
118 : Thread(message_loop->thread_name()), identifier_(identifier) { 118 : Thread(message_loop->GetThreadName()), identifier_(identifier) {
gab 2016/06/13 18:57:35 Is |message_loop| already running at this point?
alokp 2016/06/14 12:31:22 Good catch. This constructor seems to be used in u
119 set_message_loop(message_loop); 119 set_message_loop(message_loop);
120 Initialize(); 120 Initialize();
121 } 121 }
122 122
123 // static 123 // static
124 void WebThreadImpl::ShutdownThreadPool() { 124 void WebThreadImpl::ShutdownThreadPool() {
125 // The goal is to make it impossible to 'infinite loop' during shutdown, 125 // The goal is to make it impossible to 'infinite loop' during shutdown,
126 // but to reasonably expect that all BLOCKING_SHUTDOWN tasks queued during 126 // but to reasonably expect that all BLOCKING_SHUTDOWN tasks queued during
127 // shutdown get run. There's nothing particularly scientific about the 127 // shutdown get run. There's nothing particularly scientific about the
128 // number chosen. 128 // number chosen.
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 static const char* GetThreadName(WebThread::ID thread) { 374 static const char* GetThreadName(WebThread::ID thread) {
375 if (WebThread::UI <= thread && thread < WebThread::ID_COUNT) 375 if (WebThread::UI <= thread && thread < WebThread::ID_COUNT)
376 return g_web_thread_names[thread]; 376 return g_web_thread_names[thread];
377 return "Unknown Thread"; 377 return "Unknown Thread";
378 } 378 }
379 379
380 // static 380 // static
381 std::string WebThread::GetDCheckCurrentlyOnErrorMessage(ID expected) { 381 std::string WebThread::GetDCheckCurrentlyOnErrorMessage(ID expected) {
382 const base::MessageLoop* message_loop = base::MessageLoop::current(); 382 std::string actual_name = base::PlatformThread::GetName();
383 ID actual_web_thread; 383 if (actual_name.empty())
384 const char* actual_name = "Unknown Thread"; 384 actual_name = "Unknown Thread";
385 if (message_loop && !message_loop->thread_name().empty()) { 385
386 actual_name = message_loop->thread_name().c_str();
387 } else if (GetCurrentThreadIdentifier(&actual_web_thread)) {
388 actual_name = GetThreadName(actual_web_thread);
389 }
390 std::string result = "Must be called on "; 386 std::string result = "Must be called on ";
391 result += GetThreadName(expected); 387 result += GetThreadName(expected);
392 result += "; actually called on "; 388 result += "; actually called on ";
393 result += actual_name; 389 result += actual_name;
394 result += "."; 390 result += ".";
395 return result; 391 return result;
396 } 392 }
397 393
398 // static 394 // static
399 bool WebThread::IsMessageLoopValid(ID identifier) { 395 bool WebThread::IsMessageLoopValid(ID identifier) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 AtomicWord* storage = 496 AtomicWord* storage =
501 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]); 497 reinterpret_cast<AtomicWord*>(&globals.thread_delegates[identifier]);
502 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange( 498 AtomicWord old_pointer = base::subtle::NoBarrier_AtomicExchange(
503 storage, reinterpret_cast<AtomicWord>(delegate)); 499 storage, reinterpret_cast<AtomicWord>(delegate));
504 500
505 // This catches registration when previously registered. 501 // This catches registration when previously registered.
506 DCHECK(!delegate || !old_pointer); 502 DCHECK(!delegate || !old_pointer);
507 } 503 }
508 504
509 } // namespace web 505 } // namespace web
OLDNEW
« 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