Commit 97c6f1f8 authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

viz: Start the sampling profiler for oop-d thread.

Start the sampling profiler on the oop-d thread. Plumb the task-runner
of the compositor thread from viz through content to chrome, which
starts the profiler on the thread.

BUG=788808

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: Id9e05bc290205ad2d397028313b6e1a2430a9d92
Reviewed-on: https://chromium-review.googlesource.com/943401Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarMike Wittman <wittman@chromium.org>
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540396}
parent 7d87494c
......@@ -80,6 +80,14 @@ void ChromeContentGpuClient::PostIOThreadCreated(
metrics::CallStackProfileParams::IO_THREAD));
}
void ChromeContentGpuClient::PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) {
task_runner->PostTask(
FROM_HERE,
base::BindOnce(&ThreadProfiler::StartOnChildThread,
metrics::CallStackProfileParams::COMPOSITOR_THREAD));
}
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
std::unique_ptr<media::CdmProxy> ChromeContentGpuClient::CreateCdmProxy(
const std::string& cdm_guid) {
......
......@@ -35,6 +35,8 @@ class ChromeContentGpuClient : public content::ContentGpuClient {
const gpu::GpuPreferences& gpu_preferences) override;
void PostIOThreadCreated(
base::SingleThreadTaskRunner* io_task_runner) override;
void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) override;
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
std::unique_ptr<media::CdmProxy> CreateCdmProxy(
......
......@@ -133,6 +133,9 @@ VizMainImpl::VizMainImpl(Delegate* delegate,
if (dependencies_.create_display_compositor) {
compositor_thread_ = CreateAndStartCompositorThread();
compositor_thread_task_runner_ = compositor_thread_->task_runner();
if (delegate_)
delegate_->PostCompositorThreadCreated(
compositor_thread_task_runner_.get());
}
CreateUkmRecorderIfNeeded(dependencies.connector);
......
......@@ -48,6 +48,8 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain {
virtual void OnInitializationFailed() = 0;
virtual void OnGpuServiceConnection(GpuServiceImpl* gpu_service) = 0;
virtual void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) = 0;
};
struct ExternalDependencies {
......
......@@ -285,6 +285,13 @@ void GpuChildThread::OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) {
release_pending_requests_closure_.Run();
}
void GpuChildThread::PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) {
auto* gpu_client = GetContentClient()->gpu();
if (gpu_client)
gpu_client->PostCompositorThreadCreated(task_runner);
}
void GpuChildThread::BindServiceFactoryRequest(
service_manager::mojom::ServiceFactoryRequest request) {
DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
......
......@@ -77,6 +77,8 @@ class GpuChildThread : public ChildThreadImpl,
// viz::VizMainImpl::Delegate:
void OnInitializationFailed() override;
void OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) override;
void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) override;
void BindServiceFactoryRequest(
service_manager::mojom::ServiceFactoryRequest request);
......
......@@ -42,9 +42,11 @@ class CONTENT_EXPORT ContentGpuClient {
virtual void GpuServiceInitialized(
const gpu::GpuPreferences& gpu_preferences) {}
// Called right after the IO thread is created.
// Called right after the IO/compositor thread is created.
virtual void PostIOThreadCreated(
base::SingleThreadTaskRunner* io_task_runner) {}
virtual void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) {}
// Allows client to supply a SyncPointManager instance instead of having
// content internally create one.
......
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