Commit d1ef1c3b authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

gpu: Remove connection_error param for EstablishChannel

This was only used by the GPU service and nowhere else. And it became
essentially useless in the GPU service when the EstablishChannel mojo
message was turned from a sync message to an async message in
refs/heads/master@{#515693}.

So now it's always set to false everywhere. So just remove it and all
the branches of code that checks for being true.

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I40c3026f9237c58b9151343ef09696a243801632
Reviewed-on: https://chromium-review.googlesource.com/814939Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522721}
parent 8de941fb
...@@ -960,7 +960,7 @@ GpuProcessTransportFactory::SharedMainThreadContextProvider() { ...@@ -960,7 +960,7 @@ GpuProcessTransportFactory::SharedMainThreadContextProvider() {
return shared_main_thread_contexts_; return shared_main_thread_contexts_;
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = scoped_refptr<gpu::GpuChannelHost> gpu_channel_host =
gpu_channel_factory_->EstablishGpuChannelSync(nullptr); gpu_channel_factory_->EstablishGpuChannelSync();
if (!gpu_channel_host || if (!gpu_channel_host ||
gpu_channel_host->gpu_feature_info() gpu_channel_host->gpu_feature_info()
.status_values[gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING] != .status_values[gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING] !=
......
...@@ -283,13 +283,11 @@ void BrowserGpuChannelHostFactory::EstablishGpuChannel( ...@@ -283,13 +283,11 @@ void BrowserGpuChannelHostFactory::EstablishGpuChannel(
// (Opening the initial channel to a child process involves handling a reply // (Opening the initial channel to a child process involves handling a reply
// task on the UI thread first, so we cannot block here.) // task on the UI thread first, so we cannot block here.)
scoped_refptr<gpu::GpuChannelHost> scoped_refptr<gpu::GpuChannelHost>
BrowserGpuChannelHostFactory::EstablishGpuChannelSync(bool* connection_error) { BrowserGpuChannelHostFactory::EstablishGpuChannelSync() {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
NOTREACHED(); NOTREACHED();
return nullptr; return nullptr;
#endif #endif
if (connection_error)
*connection_error = false;
EstablishGpuChannel(gpu::GpuChannelEstablishedCallback()); EstablishGpuChannel(gpu::GpuChannelEstablishedCallback());
if (pending_request_.get()) if (pending_request_.get())
......
...@@ -42,8 +42,7 @@ class CONTENT_EXPORT BrowserGpuChannelHostFactory ...@@ -42,8 +42,7 @@ class CONTENT_EXPORT BrowserGpuChannelHostFactory
// shutdown. // shutdown.
void EstablishGpuChannel( void EstablishGpuChannel(
const gpu::GpuChannelEstablishedCallback& callback) override; const gpu::GpuChannelEstablishedCallback& callback) override;
scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync( scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override;
bool* connection_error) override;
gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
private: private:
......
...@@ -202,7 +202,7 @@ IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, ...@@ -202,7 +202,7 @@ IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest,
MAYBE_AlreadyEstablished) { MAYBE_AlreadyEstablished) {
DCHECK(!IsChannelEstablished()); DCHECK(!IsChannelEstablished());
scoped_refptr<gpu::GpuChannelHost> gpu_channel = scoped_refptr<gpu::GpuChannelHost> gpu_channel =
GetFactory()->EstablishGpuChannelSync(nullptr); GetFactory()->EstablishGpuChannelSync();
// Expect established callback immediately. // Expect established callback immediately.
bool event = false; bool event = false;
......
...@@ -1981,12 +1981,11 @@ void RenderThreadImpl::CompositingModeFallbackToSoftware() { ...@@ -1981,12 +1981,11 @@ void RenderThreadImpl::CompositingModeFallbackToSoftware() {
is_gpu_compositing_disabled_ = true; is_gpu_compositing_disabled_ = true;
} }
scoped_refptr<gpu::GpuChannelHost> RenderThreadImpl::EstablishGpuChannelSync( scoped_refptr<gpu::GpuChannelHost> RenderThreadImpl::EstablishGpuChannelSync() {
bool* connection_error) {
TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync");
scoped_refptr<gpu::GpuChannelHost> gpu_channel = scoped_refptr<gpu::GpuChannelHost> gpu_channel =
gpu_->EstablishGpuChannelSync(connection_error); gpu_->EstablishGpuChannelSync();
if (gpu_channel) if (gpu_channel)
GetContentClient()->SetGpuInfo(gpu_channel->gpu_info()); GetContentClient()->SetGpuInfo(gpu_channel->gpu_info());
return gpu_channel; return gpu_channel;
...@@ -2028,13 +2027,7 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink( ...@@ -2028,13 +2027,7 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink(
callback.Run(nullptr); callback.Run(nullptr);
return; return;
} }
bool connection_error = false; scoped_refptr<gpu::GpuChannelHost> channel = EstablishGpuChannelSync();
scoped_refptr<gpu::GpuChannelHost> channel =
EstablishGpuChannelSync(&connection_error);
// If the connection to the host is gone, then don't bother running the
// |callback| to retry.
if (connection_error)
return;
// If the channel could not be established correctly, then return null. This // If the channel could not be established correctly, then return null. This
// would cause the compositor to wait and try again at a later time. // would cause the compositor to wait and try again at a later time.
if (!channel) { if (!channel) {
...@@ -2077,13 +2070,8 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink( ...@@ -2077,13 +2070,8 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink(
return; return;
} }
bool connection_error = false;
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = scoped_refptr<gpu::GpuChannelHost> gpu_channel_host =
EstablishGpuChannelSync(&connection_error); EstablishGpuChannelSync();
// If the connection to the host is gone, then don't bother running the
// |callback| to retry.
if (connection_error)
return;
if (!gpu_channel_host) { if (!gpu_channel_host) {
// Wait and try again. We may hear that the compositing mode has switched // Wait and try again. We may hear that the compositing mode has switched
// to software in the meantime. // to software in the meantime.
......
...@@ -282,12 +282,8 @@ class CONTENT_EXPORT RenderThreadImpl ...@@ -282,12 +282,8 @@ class CONTENT_EXPORT RenderThreadImpl
// Synchronously establish a channel to the GPU plugin if not previously // Synchronously establish a channel to the GPU plugin if not previously
// established or if it has been lost (for example if the GPU plugin crashed). // established or if it has been lost (for example if the GPU plugin crashed).
// If there is a pending asynchronous request, it will be completed by the // If there is a pending asynchronous request, it will be completed by the
// time this routine returns. If |connection_error| is set to true, it was // time this routine returns.
// unable to connect to the host process to try establish a channel, which scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync();
// should mean that the host is shutting this process down and there's no
// reason to retry.
scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync(
bool* connection_error = nullptr);
gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager(); gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager();
......
...@@ -50,10 +50,7 @@ class GPU_EXPORT GpuChannelEstablishFactory { ...@@ -50,10 +50,7 @@ class GPU_EXPORT GpuChannelEstablishFactory {
virtual void EstablishGpuChannel( virtual void EstablishGpuChannel(
const GpuChannelEstablishedCallback& callback) = 0; const GpuChannelEstablishedCallback& callback) = 0;
// If the connection to the host process fails so the channel can not be virtual scoped_refptr<GpuChannelHost> EstablishGpuChannelSync() = 0;
// established, then |connection_error| is set to true (if it's not null).
virtual scoped_refptr<GpuChannelHost> EstablishGpuChannelSync(
bool* connection_error) = 0;
virtual GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; virtual GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0;
}; };
......
...@@ -235,12 +235,9 @@ void Gpu::EstablishGpuChannel( ...@@ -235,12 +235,9 @@ void Gpu::EstablishGpuChannel(
SendEstablishGpuChannelRequest(); SendEstablishGpuChannelRequest();
} }
scoped_refptr<gpu::GpuChannelHost> Gpu::EstablishGpuChannelSync( scoped_refptr<gpu::GpuChannelHost> Gpu::EstablishGpuChannelSync() {
bool* connection_error) {
TRACE_EVENT0("mus", "Gpu::EstablishGpuChannelSync"); TRACE_EVENT0("mus", "Gpu::EstablishGpuChannelSync");
DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK(main_task_runner_->BelongsToCurrentThread());
if (connection_error)
*connection_error = false;
scoped_refptr<gpu::GpuChannelHost> channel = GetGpuChannel(); scoped_refptr<gpu::GpuChannelHost> channel = GetGpuChannel();
if (channel) if (channel)
......
...@@ -48,8 +48,7 @@ class Gpu : public gpu::GpuChannelEstablishFactory { ...@@ -48,8 +48,7 @@ class Gpu : public gpu::GpuChannelEstablishFactory {
// gpu::GpuChannelEstablishFactory: // gpu::GpuChannelEstablishFactory:
void EstablishGpuChannel( void EstablishGpuChannel(
const gpu::GpuChannelEstablishedCallback& callback) override; const gpu::GpuChannelEstablishedCallback& callback) override;
scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync( scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync() override;
bool* connection_error) override;
gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
void LoseChannel(); void LoseChannel();
......
...@@ -246,10 +246,7 @@ TEST_F(GpuTest, EstablishRequestAsyncThenSync) { ...@@ -246,10 +246,7 @@ TEST_F(GpuTest, EstablishRequestAsyncThenSync) {
}, },
base::Unretained(&counter))); base::Unretained(&counter)));
bool connection_error = false; scoped_refptr<gpu::GpuChannelHost> host = gpu()->EstablishGpuChannelSync();
scoped_refptr<gpu::GpuChannelHost> host =
gpu()->EstablishGpuChannelSync(&connection_error);
EXPECT_FALSE(connection_error);
EXPECT_EQ(1, counter); EXPECT_EQ(1, counter);
EXPECT_TRUE(host); EXPECT_TRUE(host);
} }
...@@ -276,10 +273,7 @@ TEST_F(GpuTest, EstablishRequestAsyncThenSyncWithResponse) { ...@@ -276,10 +273,7 @@ TEST_F(GpuTest, EstablishRequestAsyncThenSyncWithResponse) {
// Run EstablishGpuChannelSync() before the posted task can run. The response // Run EstablishGpuChannelSync() before the posted task can run. The response
// to the async request should be used immediately, the pending callback // to the async request should be used immediately, the pending callback
// should fire and then EstablishGpuChannelSync() should return. // should fire and then EstablishGpuChannelSync() should return.
bool connection_error = false; scoped_refptr<gpu::GpuChannelHost> host = gpu()->EstablishGpuChannelSync();
scoped_refptr<gpu::GpuChannelHost> host =
gpu()->EstablishGpuChannelSync(&connection_error);
EXPECT_FALSE(connection_error);
EXPECT_EQ(1, counter); EXPECT_EQ(1, counter);
EXPECT_TRUE(host); EXPECT_TRUE(host);
......
...@@ -64,7 +64,7 @@ scoped_refptr<viz::ContextProvider> ...@@ -64,7 +64,7 @@ scoped_refptr<viz::ContextProvider>
MusContextFactory::SharedMainThreadContextProvider() { MusContextFactory::SharedMainThreadContextProvider() {
if (!shared_main_thread_context_provider_) { if (!shared_main_thread_context_provider_) {
scoped_refptr<gpu::GpuChannelHost> gpu_channel = scoped_refptr<gpu::GpuChannelHost> gpu_channel =
gpu_->EstablishGpuChannelSync(nullptr); gpu_->EstablishGpuChannelSync();
shared_main_thread_context_provider_ = shared_main_thread_context_provider_ =
gpu_->CreateContextProvider(std::move(gpu_channel)); gpu_->CreateContextProvider(std::move(gpu_channel));
if (shared_main_thread_context_provider_->BindToCurrentThread() != if (shared_main_thread_context_provider_->BindToCurrentThread() !=
......
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