Commit 68a391b7 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Don't set fExecutor

This was mostly used for GrVkResourceProvider::backgroundReset. Sampling
profiles of Chrome on Pixel 3 and S10E suggest that it costs more CPU
time post the task than it does to execute it.

Change-Id: Id415eb60207b0eb724ad1308875ab9d251ea5ef6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402078Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Commit-Queue: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805532}
parent 8ba65628
......@@ -6,8 +6,6 @@
#include <utility>
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "gpu/vulkan/buildflags.h"
#include "gpu/vulkan/init/gr_vk_memory_allocator_impl.h"
#include "gpu/vulkan/vulkan_device_queue.h"
......@@ -16,30 +14,9 @@
#include "gpu/vulkan/vulkan_implementation.h"
#include "gpu/vulkan/vulkan_instance.h"
#include "gpu/vulkan/vulkan_util.h"
#include "third_party/skia/include/core/SkExecutor.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/vk/GrVkExtensions.h"
namespace {
class VizExecutor : public SkExecutor {
public:
VizExecutor() = default;
~VizExecutor() override = default;
VizExecutor(const VizExecutor&) = delete;
VizExecutor& operator=(const VizExecutor&) = delete;
// std::function is used by SkExecutor in //third_party/skia. nocheck
using Fn = std::function<void(void)>; // nocheck
// SkExecutor:
void add(Fn task) override {
base::ThreadPool::PostTask(
FROM_HERE, base::BindOnce([](Fn task) { task(); }, std::move(task)));
}
};
} // namespace
namespace viz {
// static
......@@ -127,16 +104,7 @@ bool VulkanInProcessContextProvider::Initialize(
vulkan_implementation_->enforce_protected_memory() ? GrProtected::kYes
: GrProtected::kNo;
GrContextOptions options;
if (base::ThreadPoolInstance::Get()) {
// For some tests, ThreadPoolInstance is not initialized. VizExecutor will
// not be used for this case.
// TODO(penghuang): Make sure ThreadPoolInstance is initialized for related
// tests.
executor_ = std::make_unique<VizExecutor>();
options.fExecutor = executor_.get();
}
gr_context_ = GrDirectContext::MakeVulkan(backend_context, options);
gr_context_ = GrDirectContext::MakeVulkan(backend_context, context_options);
return gr_context_ != nullptr;
}
......@@ -156,8 +124,6 @@ void VulkanInProcessContextProvider::Destroy() {
gr_context_.reset();
}
executor_.reset();
if (device_queue_) {
device_queue_->Destroy();
device_queue_.reset();
......
......@@ -17,8 +17,6 @@
#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h"
#endif
class SkExecutor;
namespace gpu {
class VulkanImplementation;
class VulkanDeviceQueue;
......@@ -56,7 +54,6 @@ class VIZ_VULKAN_CONTEXT_PROVIDER_EXPORT VulkanInProcessContextProvider
#if BUILDFLAG(ENABLE_VULKAN)
sk_sp<GrDirectContext> gr_context_;
std::unique_ptr<SkExecutor> executor_;
gpu::VulkanImplementation* vulkan_implementation_;
std::unique_ptr<gpu::VulkanDeviceQueue> device_queue_;
#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