Commit 75caba1f authored by Sergio Villar Senin's avatar Sergio Villar Senin Committed by Commit Bot

Remove WebThreadSupportingGC from tree

This is the last step of the WebThreadSupportingGC removal. Now that all the
callers have been converted to use blink::Thread and the GC handling moved to
WorkerThread::SimpleThreadImpl we can safely remove it.

Bug: 961743
Change-Id: I033fa80edbe5eaac5f3d36ade50bffd06635ff24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1655305
Commit-Queue: Sergio Villar <svillar@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669654}
parent e6ad2a6e
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
namespace blink { namespace blink {
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/core/workers/worker_thread.h" #include "third_party/blink/renderer/core/workers/worker_thread.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
namespace blink { namespace blink {
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.h" #include "third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.h"
#include "third_party/blink/renderer/core/workers/global_scope_creation_params.h" #include "third_party/blink/renderer/core/workers/global_scope_creation_params.h"
#include "third_party/blink/renderer/core/workers/worker_backing_thread.h" #include "third_party/blink/renderer/core/workers/worker_backing_thread.h"
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
namespace blink { namespace blink {
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/network/content_security_policy_parsers.h" #include "third_party/blink/renderer/platform/network/content_security_policy_parsers.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "third_party/blink/renderer/core/workers/worker_backing_thread.h" #include "third_party/blink/renderer/core/workers/worker_backing_thread.h"
#include "third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h" #include "third_party/blink/renderer/core/workers/worker_backing_thread_startup_data.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
namespace blink { namespace blink {
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "third_party/blink/renderer/modules/webaudio/audio_worklet.h" #include "third_party/blink/renderer/modules/webaudio/audio_worklet.h"
#include "third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h" #include "third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/assertions.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h" #include "third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
namespace blink { namespace blink {
......
...@@ -1336,8 +1336,6 @@ jumbo_component("platform") { ...@@ -1336,8 +1336,6 @@ jumbo_component("platform") {
"web_test_support.cc", "web_test_support.cc",
"web_test_support.h", "web_test_support.h",
"web_text_input_info.cc", "web_text_input_info.cc",
"web_thread_supporting_gc.cc",
"web_thread_supporting_gc.h",
"web_thread_type.cc", "web_thread_type.cc",
"web_touch_event.cc", "web_touch_event.cc",
"weborigin/known_ports.cc", "weborigin/known_ports.cc",
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/platform/web_thread_supporting_gc.h"
#include <memory>
#include "base/memory/ptr_util.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/threading.h"
namespace blink {
WebThreadSupportingGC::WebThreadSupportingGC(
const ThreadCreationParams& params) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
#if DCHECK_IS_ON()
WTF::WillCreateThread();
#endif
if (params.thread_type == WebThreadType::kAudioWorkletThread) {
thread_ = Thread::CreateWebAudioThread();
} else {
ThreadCreationParams gc_enabled_params = params;
gc_enabled_params.supports_gc = true;
thread_ = Thread::CreateThread(gc_enabled_params);
}
}
WebThreadSupportingGC::~WebThreadSupportingGC() {
DETACH_FROM_THREAD(thread_checker_);
// blink::Thread's destructor blocks until all the tasks are processed.
thread_.reset();
}
scoped_refptr<base::SingleThreadTaskRunner>
WebThreadSupportingGC::GetTaskRunner() const {
return thread_->GetTaskRunner();
}
void WebThreadSupportingGC::InitializeOnThread() {
DCHECK(thread_->IsCurrentThread());
ThreadState::AttachCurrentThread();
gc_task_runner_ = std::make_unique<GCTaskRunner>(thread_.get());
}
void WebThreadSupportingGC::ShutdownOnThread() {
DCHECK(thread_->IsCurrentThread());
#if defined(LEAK_SANITIZER)
ThreadState::Current()->ReleaseStaticPersistentNodes();
#endif
// Ensure no posted tasks will run from this point on.
gc_task_runner_.reset();
// Shutdown the thread (via its scheduler).
thread_->Scheduler()->Shutdown();
ThreadState::DetachCurrentThread();
}
} // namespace blink
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WEB_THREAD_SUPPORTING_GC_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WEB_THREAD_SUPPORTING_GC_H_
#include <memory>
#include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/heap/gc_task_runner.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/time.h"
namespace blink {
// WebThreadSupportingGC wraps a blink::Thread and adds support for attaching
// to and detaching from the Blink GC infrastructure.
//
// The initialize method must be called during initialization on the Thread
// and before the thread allocates any objects managed by the Blink GC. The
// shutdown method must be called on the Thread during shutdown when the
// thread no longer needs to access objects managed by the Blink GC.
//
// WebThreadSupportingGC internally creates and owns Thread.
class PLATFORM_EXPORT WebThreadSupportingGC final {
USING_FAST_MALLOC(WebThreadSupportingGC);
public:
explicit WebThreadSupportingGC(const ThreadCreationParams&);
~WebThreadSupportingGC();
scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() const;
bool IsCurrentThread() const { return thread_->IsCurrentThread(); }
void AddTaskObserver(Thread::TaskObserver* observer) {
thread_->AddTaskObserver(observer);
}
void RemoveTaskObserver(Thread::TaskObserver* observer) {
thread_->RemoveTaskObserver(observer);
}
// Must be called on the matching blink::Thread.
void InitializeOnThread();
void ShutdownOnThread();
Thread& PlatformThread() const {
DCHECK(thread_);
return *thread_;
}
private:
std::unique_ptr<GCTaskRunner> gc_task_runner_;
std::unique_ptr<Thread> thread_;
THREAD_CHECKER(thread_checker_);
DISALLOW_COPY_AND_ASSIGN(WebThreadSupportingGC);
};
} // namespace blink
#endif
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