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

Unified Diff: services/ui/gpu/gpu_service.cc

Issue 2779903005: gpu: Destroy the BindingSet on the thread it's bound on. (Closed)
Patch Set: . Created 3 years, 9 months 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/gpu/gpu_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/gpu/gpu_service.cc
diff --git a/services/ui/gpu/gpu_service.cc b/services/ui/gpu/gpu_service.cc
index 5fe9908bd2d7c5066507765f6c5f53b9e7324ad0..5864c64160314e74bef8cd0779b29309e3ce3093 100644
--- a/services/ui/gpu/gpu_service.cc
+++ b/services/ui/gpu/gpu_service.cc
@@ -74,6 +74,11 @@ const base::Callback<void(const Param&)> WrapCallback(
runner, callback);
}
+void DestroyBinding(
+ std::unique_ptr<mojo::BindingSet<mojom::GpuService>> binding) {
+ binding->CloseAllBindings();
+}
+
} // namespace
GpuService::GpuService(const gpu::GPUInfo& gpu_info,
@@ -99,7 +104,10 @@ GpuService::~GpuService() {
logging::SetLogMessageHandler(nullptr);
g_log_callback.Get() =
base::Callback<void(int, size_t, const std::string&)>();
- bindings_.CloseAllBindings();
+ if (bindings_) {
+ io_runner_->PostTask(FROM_HERE,
+ base::Bind(&DestroyBinding, base::Passed(&bindings_)));
+ }
media_gpu_channel_manager_.reset();
gpu_channel_manager_.reset();
owned_sync_point_manager_.reset();
@@ -174,7 +182,9 @@ void GpuService::Bind(mojom::GpuServiceRequest request) {
base::Passed(std::move(request))));
return;
}
- bindings_.AddBinding(this, std::move(request));
+ if (!bindings_)
+ bindings_ = base::MakeUnique<mojo::BindingSet<mojom::GpuService>>();
+ bindings_->AddBinding(this, std::move(request));
}
void GpuService::RecordLogMessage(int severity,
@@ -348,10 +358,10 @@ void GpuService::EstablishGpuChannel(
if (io_runner_->BelongsToCurrentThread()) {
EstablishGpuChannelCallback wrap_callback = base::Bind(
[](scoped_refptr<base::SingleThreadTaskRunner> runner,
- const EstablishGpuChannelCallback& callback,
+ const EstablishGpuChannelCallback& cb,
mojo::ScopedMessagePipeHandle handle) {
- runner->PostTask(
- FROM_HERE, base::Bind(callback, base::Passed(std::move(handle))));
+ runner->PostTask(FROM_HERE,
+ base::Bind(cb, base::Passed(std::move(handle))));
},
io_runner_, callback);
main_runner_->PostTask(
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698