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( ...@@ -80,6 +80,14 @@ void ChromeContentGpuClient::PostIOThreadCreated(
metrics::CallStackProfileParams::IO_THREAD)); 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) #if BUILDFLAG(ENABLE_LIBRARY_CDMS)
std::unique_ptr<media::CdmProxy> ChromeContentGpuClient::CreateCdmProxy( std::unique_ptr<media::CdmProxy> ChromeContentGpuClient::CreateCdmProxy(
const std::string& cdm_guid) { const std::string& cdm_guid) {
......
...@@ -35,6 +35,8 @@ class ChromeContentGpuClient : public content::ContentGpuClient { ...@@ -35,6 +35,8 @@ class ChromeContentGpuClient : public content::ContentGpuClient {
const gpu::GpuPreferences& gpu_preferences) override; const gpu::GpuPreferences& gpu_preferences) override;
void PostIOThreadCreated( void PostIOThreadCreated(
base::SingleThreadTaskRunner* io_task_runner) override; base::SingleThreadTaskRunner* io_task_runner) override;
void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) override;
#if BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(ENABLE_LIBRARY_CDMS)
std::unique_ptr<media::CdmProxy> CreateCdmProxy( std::unique_ptr<media::CdmProxy> CreateCdmProxy(
......
...@@ -133,6 +133,9 @@ VizMainImpl::VizMainImpl(Delegate* delegate, ...@@ -133,6 +133,9 @@ VizMainImpl::VizMainImpl(Delegate* delegate,
if (dependencies_.create_display_compositor) { if (dependencies_.create_display_compositor) {
compositor_thread_ = CreateAndStartCompositorThread(); compositor_thread_ = CreateAndStartCompositorThread();
compositor_thread_task_runner_ = compositor_thread_->task_runner(); compositor_thread_task_runner_ = compositor_thread_->task_runner();
if (delegate_)
delegate_->PostCompositorThreadCreated(
compositor_thread_task_runner_.get());
} }
CreateUkmRecorderIfNeeded(dependencies.connector); CreateUkmRecorderIfNeeded(dependencies.connector);
......
...@@ -48,6 +48,8 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain { ...@@ -48,6 +48,8 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain {
virtual void OnInitializationFailed() = 0; virtual void OnInitializationFailed() = 0;
virtual void OnGpuServiceConnection(GpuServiceImpl* gpu_service) = 0; virtual void OnGpuServiceConnection(GpuServiceImpl* gpu_service) = 0;
virtual void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) = 0;
}; };
struct ExternalDependencies { struct ExternalDependencies {
......
...@@ -285,6 +285,13 @@ void GpuChildThread::OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) { ...@@ -285,6 +285,13 @@ void GpuChildThread::OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) {
release_pending_requests_closure_.Run(); 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( void GpuChildThread::BindServiceFactoryRequest(
service_manager::mojom::ServiceFactoryRequest request) { service_manager::mojom::ServiceFactoryRequest request) {
DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
......
...@@ -77,6 +77,8 @@ class GpuChildThread : public ChildThreadImpl, ...@@ -77,6 +77,8 @@ class GpuChildThread : public ChildThreadImpl,
// viz::VizMainImpl::Delegate: // viz::VizMainImpl::Delegate:
void OnInitializationFailed() override; void OnInitializationFailed() override;
void OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) override; void OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) override;
void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) override;
void BindServiceFactoryRequest( void BindServiceFactoryRequest(
service_manager::mojom::ServiceFactoryRequest request); service_manager::mojom::ServiceFactoryRequest request);
......
...@@ -42,9 +42,11 @@ class CONTENT_EXPORT ContentGpuClient { ...@@ -42,9 +42,11 @@ class CONTENT_EXPORT ContentGpuClient {
virtual void GpuServiceInitialized( virtual void GpuServiceInitialized(
const gpu::GpuPreferences& gpu_preferences) {} 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( virtual void PostIOThreadCreated(
base::SingleThreadTaskRunner* io_task_runner) {} base::SingleThreadTaskRunner* io_task_runner) {}
virtual void PostCompositorThreadCreated(
base::SingleThreadTaskRunner* task_runner) {}
// Allows client to supply a SyncPointManager instance instead of having // Allows client to supply a SyncPointManager instance instead of having
// content internally create one. // 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