Commit 171c0f9d authored by Alexander Timin's avatar Alexander Timin Committed by Commit Bot

WebThreadCreationParams::SetThreadNameForTest

Rename WebThreadCreationParams::SetThreadName to
WebThreadCreationParams::SetThreadNameForTest to clarify that in
non-test code thread name is inferred from thread type.

R=kinuko@chromium.org,haraken@chromium.org

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I359cf449dba6cb2544f65a3624ecc6761c425f7f
Reviewed-on: https://chromium-review.googlesource.com/964366Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543677}
parent ed6545e5
...@@ -119,7 +119,7 @@ TEST(DOMWrapperWorldTest, Basic) { ...@@ -119,7 +119,7 @@ TEST(DOMWrapperWorldTest, Basic) {
// Start a worker thread and create worlds on that. // Start a worker thread and create worlds on that.
std::unique_ptr<WorkerBackingThread> thread = WorkerBackingThread::Create( std::unique_ptr<WorkerBackingThread> thread = WorkerBackingThread::Create(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("DOMWrapperWorld test thread")); .SetThreadNameForTest("DOMWrapperWorld test thread"));
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
Platform::Current()->CurrentThread()->GetTaskRunner(); Platform::Current()->CurrentThread()->GetTaskRunner();
thread->BackingThread().PostTask( thread->BackingThread().PostTask(
......
...@@ -168,10 +168,10 @@ class DataConsumerHandleTestUtil { ...@@ -168,10 +168,10 @@ class DataConsumerHandleTestUtil {
: context_(test->context_), : context_(test->context_),
reading_thread_(std::make_unique<Thread>( reading_thread_(std::make_unique<Thread>(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("reading thread"))), .SetThreadNameForTest("reading thread"))),
updating_thread_(std::make_unique<Thread>( updating_thread_(std::make_unique<Thread>(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("updating thread"))) { .SetThreadNameForTest("updating thread"))) {
context_->RegisterThreadHolder(this); context_->RegisterThreadHolder(this);
} }
~ThreadHolder() { context_->UnregisterThreadHolder(); } ~ThreadHolder() { context_->UnregisterThreadHolder(); }
......
...@@ -71,7 +71,7 @@ class ThreadedWorkletThreadForTest : public WorkerThread { ...@@ -71,7 +71,7 @@ class ThreadedWorkletThreadForTest : public WorkerThread {
DCHECK(IsMainThread()); DCHECK(IsMainThread());
WorkletThreadHolder<ThreadedWorkletThreadForTest>::CreateForTest( WorkletThreadHolder<ThreadedWorkletThreadForTest>::CreateForTest(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("ThreadedWorkletThreadForTest")); .SetThreadNameForTest("ThreadedWorkletThreadForTest"));
} }
static void ClearSharedBackingThread() { static void ClearSharedBackingThread() {
......
...@@ -42,7 +42,7 @@ class AnimationWorkletTestPlatform : public TestingPlatformSupport { ...@@ -42,7 +42,7 @@ class AnimationWorkletTestPlatform : public TestingPlatformSupport {
AnimationWorkletTestPlatform() AnimationWorkletTestPlatform()
: thread_(old_platform_->CreateThread( : thread_(old_platform_->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Compositor"))) {} .SetThreadNameForTest("Compositor"))) {}
WebThread* CompositorThread() const override { return thread_.get(); } WebThread* CompositorThread() const override { return thread_.get(); }
......
...@@ -21,7 +21,7 @@ WebThreadCreationParams::WebThreadCreationParams(WebThreadType thread_type) ...@@ -21,7 +21,7 @@ WebThreadCreationParams::WebThreadCreationParams(WebThreadType thread_type)
name(GetNameForThreadType(thread_type)), name(GetNameForThreadType(thread_type)),
frame_scheduler(nullptr) {} frame_scheduler(nullptr) {}
WebThreadCreationParams& WebThreadCreationParams::SetThreadName( WebThreadCreationParams& WebThreadCreationParams::SetThreadNameForTest(
const char* thread_name) { const char* thread_name) {
name = thread_name; name = thread_name;
return *this; return *this;
......
...@@ -30,7 +30,7 @@ class FIFOClient { ...@@ -30,7 +30,7 @@ class FIFOClient {
bus_(AudioBus::Create(fifo->NumberOfChannels(), bus_length)), bus_(AudioBus::Create(fifo->NumberOfChannels(), bus_length)),
client_thread_(Platform::Current()->CreateThread( client_thread_(Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("FIFOClientThread"))), .SetThreadNameForTest("FIFOClientThread"))),
done_event_(std::make_unique<WaitableEvent>()), done_event_(std::make_unique<WaitableEvent>()),
jitter_range_ms_(jitter_range_ms) {} jitter_range_ms_(jitter_range_ms) {}
......
...@@ -226,7 +226,7 @@ TEST_F(DeferredImageDecoderTest, MAYBE_decodeOnOtherThread) { ...@@ -226,7 +226,7 @@ TEST_F(DeferredImageDecoderTest, MAYBE_decodeOnOtherThread) {
// Create a thread to rasterize PaintRecord. // Create a thread to rasterize PaintRecord.
std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread( std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("RasterThread")); .SetThreadNameForTest("RasterThread"));
PostCrossThreadTask( PostCrossThreadTask(
*thread->GetTaskRunner(), FROM_HERE, *thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&RasterizeMain, CrossThreadUnretained(canvas_.get()), CrossThreadBind(&RasterizeMain, CrossThreadUnretained(canvas_.get()),
......
...@@ -257,7 +257,7 @@ TEST_F(ImageFrameGeneratorTest, incompleteDecodeBecomesCompleteMultiThreaded) { ...@@ -257,7 +257,7 @@ TEST_F(ImageFrameGeneratorTest, incompleteDecodeBecomesCompleteMultiThreaded) {
AddNewData(); AddNewData();
std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread( std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("DecodeThread")); .SetThreadNameForTest("DecodeThread"));
PostCrossThreadTask( PostCrossThreadTask(
*thread->GetTaskRunner(), FROM_HERE, *thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&DecodeThreadMain, WTF::RetainedRef(generator_), CrossThreadBind(&DecodeThreadMain, WTF::RetainedRef(generator_),
......
...@@ -485,7 +485,7 @@ class ThreadedTesterBase { ...@@ -485,7 +485,7 @@ class ThreadedTesterBase {
for (int i = 0; i < kNumberOfThreads; i++) { for (int i = 0; i < kNumberOfThreads; i++) {
threads.push_back(Platform::Current()->CreateThread( threads.push_back(Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("blink gc testing thread"))); .SetThreadNameForTest("blink gc testing thread")));
PostCrossThreadTask( PostCrossThreadTask(
*threads.back()->GetTaskRunner(), FROM_HERE, *threads.back()->GetTaskRunner(), FROM_HERE,
CrossThreadBind(ThreadFunc, CrossThreadUnretained(tester))); CrossThreadBind(ThreadFunc, CrossThreadUnretained(tester)));
...@@ -5487,7 +5487,7 @@ class ThreadedStrongificationTester { ...@@ -5487,7 +5487,7 @@ class ThreadedStrongificationTester {
std::unique_ptr<WebThread> worker_thread = std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread( Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread")); .SetThreadNameForTest("Test Worker Thread"));
PostCrossThreadTask(*worker_thread->GetTaskRunner(), FROM_HERE, PostCrossThreadTask(*worker_thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(WorkerThreadMain)); CrossThreadBind(WorkerThreadMain));
...@@ -5588,7 +5588,7 @@ class MemberSameThreadCheckTester { ...@@ -5588,7 +5588,7 @@ class MemberSameThreadCheckTester {
std::unique_ptr<WebThread> worker_thread = std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread( Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread")); .SetThreadNameForTest("Test Worker Thread"));
PostCrossThreadTask( PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE, *worker_thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&MemberSameThreadCheckTester::WorkerThreadMain, CrossThreadBind(&MemberSameThreadCheckTester::WorkerThreadMain,
...@@ -5633,7 +5633,7 @@ class PersistentSameThreadCheckTester { ...@@ -5633,7 +5633,7 @@ class PersistentSameThreadCheckTester {
std::unique_ptr<WebThread> worker_thread = std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread( Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread")); .SetThreadNameForTest("Test Worker Thread"));
PostCrossThreadTask( PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE, *worker_thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&PersistentSameThreadCheckTester::WorkerThreadMain, CrossThreadBind(&PersistentSameThreadCheckTester::WorkerThreadMain,
...@@ -5678,7 +5678,7 @@ class MarkingSameThreadCheckTester { ...@@ -5678,7 +5678,7 @@ class MarkingSameThreadCheckTester {
std::unique_ptr<WebThread> worker_thread = std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread( Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread")); .SetThreadNameForTest("Test Worker Thread"));
Persistent<MainThreadObject> main_thread_object = new MainThreadObject(); Persistent<MainThreadObject> main_thread_object = new MainThreadObject();
PostCrossThreadTask( PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE, *worker_thread->GetTaskRunner(), FROM_HERE,
...@@ -6478,7 +6478,7 @@ TEST(HeapTest, CrossThreadWeakPersistent) { ...@@ -6478,7 +6478,7 @@ TEST(HeapTest, CrossThreadWeakPersistent) {
MutexLocker main_thread_mutex_locker(MainThreadMutex()); MutexLocker main_thread_mutex_locker(MainThreadMutex());
std::unique_ptr<WebThread> worker_thread = Platform::Current()->CreateThread( std::unique_ptr<WebThread> worker_thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread")); .SetThreadNameForTest("Test Worker Thread"));
DestructorLockingObject* object = nullptr; DestructorLockingObject* object = nullptr;
PostCrossThreadTask( PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE, *worker_thread->GetTaskRunner(), FROM_HERE,
......
...@@ -78,7 +78,7 @@ TEST(ResourceResponseTest, CrossThreadAtomicStrings) { ...@@ -78,7 +78,7 @@ TEST(ResourceResponseTest, CrossThreadAtomicStrings) {
RunHeaderRelatedTest(response); RunHeaderRelatedTest(response);
std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread( std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread) WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("WorkerThread")); .SetThreadNameForTest("WorkerThread"));
PostCrossThreadTask(*thread->GetTaskRunner(), FROM_HERE, PostCrossThreadTask(*thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&RunInThread)); CrossThreadBind(&RunInThread));
thread.reset(); thread.reset();
......
...@@ -48,7 +48,7 @@ typedef uintptr_t PlatformThreadId; ...@@ -48,7 +48,7 @@ typedef uintptr_t PlatformThreadId;
struct BLINK_PLATFORM_EXPORT WebThreadCreationParams { struct BLINK_PLATFORM_EXPORT WebThreadCreationParams {
explicit WebThreadCreationParams(WebThreadType); explicit WebThreadCreationParams(WebThreadType);
WebThreadCreationParams& SetThreadName(const char* name); WebThreadCreationParams& SetThreadNameForTest(const char* name);
// Sets a scheduler for the frame which was responsible for the creation // Sets a scheduler for the frame which was responsible for the creation
// of this thread. // of this thread.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment