Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: services/ui/ws/gpu_service_proxy.cc

Issue 2546563002: mus: Reconnect to gpu process when it dies.
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/gpu_service_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/gpu_service_proxy.cc
diff --git a/services/ui/ws/gpu_service_proxy.cc b/services/ui/ws/gpu_service_proxy.cc
index d5815458845b42e44dff7f38b60c355b79bbedef..ec24addb8e86db7f1dfcfd731e2ba11b38f764a1 100644
--- a/services/ui/ws/gpu_service_proxy.cc
+++ b/services/ui/ws/gpu_service_proxy.cc
@@ -43,6 +43,10 @@ class GpuServiceImpl : public mojom::GpuService {
}
~GpuServiceImpl() override {}
+ void reset_gpu_service_internal(mojom::GpuServiceInternal* connection) {
+ gpu_service_internal_ = connection;
+ }
+
private:
void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback,
mojo::ScopedMessagePipeHandle channel_handle) {
@@ -101,6 +105,9 @@ GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate)
// TODO(sad): Once GPU process is split, this would look like:
// connector->ConnectToInterface("gpu", &gpu_service_);
gpu_main_.Create(GetProxy(&gpu_service_));
+ gpu_service_.set_connection_error_handler(
+ base::Bind(&GpuServiceProxy::OnGpuConnectionGone,
+ base::Unretained(this)));
gpu_service_->Initialize(
base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this)));
gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>(
@@ -111,11 +118,11 @@ GpuServiceProxy::~GpuServiceProxy() {
}
void GpuServiceProxy::Add(mojom::GpuServiceRequest request) {
- mojo::MakeStrongBinding(
+ clients_.push_back(mojo::MakeStrongBinding(
base::MakeUnique<GpuServiceImpl>(next_client_id_++, &gpu_info_,
gpu_memory_buffer_manager_.get(),
gpu_service_.get()),
- std::move(request));
+ std::move(request)));
}
void GpuServiceProxy::CreateDisplayCompositor(
@@ -129,5 +136,18 @@ void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) {
delegate_->OnGpuServiceInitialized();
}
+void GpuServiceProxy::OnGpuConnectionGone() {
+ // TODO(sad): Once GPU process is split, this would look like:
+ // connector->ConnectToInterface("gpu", &gpu_service_);
+ gpu_main_.Create(GetProxy(&gpu_service_));
+ gpu_service_.set_connection_error_handler(
+ base::Bind(&GpuServiceProxy::OnGpuConnectionGone,
+ base::Unretained(this)));
+ for (auto& weak_ptr : clients_) {
+ GpuServiceImpl* client = static_cast<GpuServiceImpl*>(weak_ptr->impl());
+ client->reset_gpu_service_internal(gpu_service_.get());
+ }
+}
+
} // namespace ws
} // namespace ui
« no previous file with comments | « services/ui/ws/gpu_service_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698