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) {
// Start a worker thread and create worlds on that.
std::unique_ptr<WorkerBackingThread> thread = WorkerBackingThread::Create(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("DOMWrapperWorld test thread"));
.SetThreadNameForTest("DOMWrapperWorld test thread"));
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
Platform::Current()->CurrentThread()->GetTaskRunner();
thread->BackingThread().PostTask(
......
......@@ -168,10 +168,10 @@ class DataConsumerHandleTestUtil {
: context_(test->context_),
reading_thread_(std::make_unique<Thread>(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("reading thread"))),
.SetThreadNameForTest("reading thread"))),
updating_thread_(std::make_unique<Thread>(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("updating thread"))) {
.SetThreadNameForTest("updating thread"))) {
context_->RegisterThreadHolder(this);
}
~ThreadHolder() { context_->UnregisterThreadHolder(); }
......
......@@ -71,7 +71,7 @@ class ThreadedWorkletThreadForTest : public WorkerThread {
DCHECK(IsMainThread());
WorkletThreadHolder<ThreadedWorkletThreadForTest>::CreateForTest(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("ThreadedWorkletThreadForTest"));
.SetThreadNameForTest("ThreadedWorkletThreadForTest"));
}
static void ClearSharedBackingThread() {
......
......@@ -42,7 +42,7 @@ class AnimationWorkletTestPlatform : public TestingPlatformSupport {
AnimationWorkletTestPlatform()
: thread_(old_platform_->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Compositor"))) {}
.SetThreadNameForTest("Compositor"))) {}
WebThread* CompositorThread() const override { return thread_.get(); }
......
......@@ -21,7 +21,7 @@ WebThreadCreationParams::WebThreadCreationParams(WebThreadType thread_type)
name(GetNameForThreadType(thread_type)),
frame_scheduler(nullptr) {}
WebThreadCreationParams& WebThreadCreationParams::SetThreadName(
WebThreadCreationParams& WebThreadCreationParams::SetThreadNameForTest(
const char* thread_name) {
name = thread_name;
return *this;
......
......@@ -30,7 +30,7 @@ class FIFOClient {
bus_(AudioBus::Create(fifo->NumberOfChannels(), bus_length)),
client_thread_(Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("FIFOClientThread"))),
.SetThreadNameForTest("FIFOClientThread"))),
done_event_(std::make_unique<WaitableEvent>()),
jitter_range_ms_(jitter_range_ms) {}
......
......@@ -226,7 +226,7 @@ TEST_F(DeferredImageDecoderTest, MAYBE_decodeOnOtherThread) {
// Create a thread to rasterize PaintRecord.
std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("RasterThread"));
.SetThreadNameForTest("RasterThread"));
PostCrossThreadTask(
*thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&RasterizeMain, CrossThreadUnretained(canvas_.get()),
......
......@@ -257,7 +257,7 @@ TEST_F(ImageFrameGeneratorTest, incompleteDecodeBecomesCompleteMultiThreaded) {
AddNewData();
std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("DecodeThread"));
.SetThreadNameForTest("DecodeThread"));
PostCrossThreadTask(
*thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&DecodeThreadMain, WTF::RetainedRef(generator_),
......
......@@ -485,7 +485,7 @@ class ThreadedTesterBase {
for (int i = 0; i < kNumberOfThreads; i++) {
threads.push_back(Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("blink gc testing thread")));
.SetThreadNameForTest("blink gc testing thread")));
PostCrossThreadTask(
*threads.back()->GetTaskRunner(), FROM_HERE,
CrossThreadBind(ThreadFunc, CrossThreadUnretained(tester)));
......@@ -5487,7 +5487,7 @@ class ThreadedStrongificationTester {
std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread"));
.SetThreadNameForTest("Test Worker Thread"));
PostCrossThreadTask(*worker_thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(WorkerThreadMain));
......@@ -5588,7 +5588,7 @@ class MemberSameThreadCheckTester {
std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread"));
.SetThreadNameForTest("Test Worker Thread"));
PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&MemberSameThreadCheckTester::WorkerThreadMain,
......@@ -5633,7 +5633,7 @@ class PersistentSameThreadCheckTester {
std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread"));
.SetThreadNameForTest("Test Worker Thread"));
PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&PersistentSameThreadCheckTester::WorkerThreadMain,
......@@ -5678,7 +5678,7 @@ class MarkingSameThreadCheckTester {
std::unique_ptr<WebThread> worker_thread =
Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread"));
.SetThreadNameForTest("Test Worker Thread"));
Persistent<MainThreadObject> main_thread_object = new MainThreadObject();
PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE,
......@@ -6478,7 +6478,7 @@ TEST(HeapTest, CrossThreadWeakPersistent) {
MutexLocker main_thread_mutex_locker(MainThreadMutex());
std::unique_ptr<WebThread> worker_thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("Test Worker Thread"));
.SetThreadNameForTest("Test Worker Thread"));
DestructorLockingObject* object = nullptr;
PostCrossThreadTask(
*worker_thread->GetTaskRunner(), FROM_HERE,
......
......@@ -78,7 +78,7 @@ TEST(ResourceResponseTest, CrossThreadAtomicStrings) {
RunHeaderRelatedTest(response);
std::unique_ptr<WebThread> thread = Platform::Current()->CreateThread(
WebThreadCreationParams(WebThreadType::kTestThread)
.SetThreadName("WorkerThread"));
.SetThreadNameForTest("WorkerThread"));
PostCrossThreadTask(*thread->GetTaskRunner(), FROM_HERE,
CrossThreadBind(&RunInThread));
thread.reset();
......
......@@ -48,7 +48,7 @@ typedef uintptr_t PlatformThreadId;
struct BLINK_PLATFORM_EXPORT WebThreadCreationParams {
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
// 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