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

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

Issue 2764753004: mus-gpu: Talk to the GpuHost from the IO thread. (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 496de6b841a54d77a620665d22881efc0b79644f..2bdfe628b93a9c1bafb5d42d44786e2a83751465 100644
--- a/services/ui/gpu/gpu_service.cc
+++ b/services/ui/gpu/gpu_service.cc
@@ -75,8 +75,6 @@ void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host,
gpu::SyncPointManager* sync_point_manager,
base::WaitableEvent* shutdown_event) {
DCHECK(CalledOnValidThread());
- DCHECK(!gpu_host_);
- gpu_host_ = std::move(gpu_host);
gpu_preferences_ = preferences;
gpu_info_.video_decode_accelerator_capabilities =
media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_);
@@ -85,7 +83,12 @@ void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host,
gpu_info_.jpeg_decode_accelerator_supported =
media::GpuJpegDecodeAcceleratorFactoryProvider::
IsAcceleratedJpegDecodeSupported();
- gpu_host_->DidInitialize(gpu_info_);
+ gpu_host->DidInitialize(gpu_info_);
+
+ task_tracker_.PostTask(
+ io_runner_.get(), FROM_HERE,
+ base::Bind(&GpuService::BindGpuHostOnIO, base::Unretained(this),
+ base::Passed(gpu_host.PassInterface())));
sync_point_manager_ = sync_point_manager;
if (!sync_point_manager_) {
@@ -111,6 +114,13 @@ void GpuService::Bind(mojom::GpuServiceRequest request) {
bindings_.AddBinding(this, std::move(request));
}
+void GpuService::BindGpuHostOnIO(mojom::GpuHostPtrInfo ptr_info) {
+ DCHECK(io_runner_->RunsTasksOnCurrentThread());
+ mojom::GpuHostPtr gpu_host;
+ gpu_host.Bind(std::move(ptr_info));
+ gpu_host_ = mojom::ThreadSafeGpuHostPtr::Create(std::move(gpu_host));
Ken Rockot(use gerrit already) 2017/03/21 22:40:35 The ThreadSafeInterfacePtr itself is thread-safe,
sadrul 2017/03/21 22:43:10 Ooh, so ThreadSafe* can be take a task-runner of a
sadrul 2017/03/21 23:14:17 Done.
+}
+
void GpuService::CreateGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
@@ -143,35 +153,35 @@ void GpuService::GetVideoMemoryUsageStats(
}
void GpuService::DidCreateOffscreenContext(const GURL& active_url) {
- gpu_host_->DidCreateOffscreenContext(active_url);
+ (*gpu_host_)->DidCreateOffscreenContext(active_url);
}
void GpuService::DidDestroyChannel(int client_id) {
media_gpu_channel_manager_->RemoveChannel(client_id);
- gpu_host_->DidDestroyChannel(client_id);
+ (*gpu_host_)->DidDestroyChannel(client_id);
}
void GpuService::DidDestroyOffscreenContext(const GURL& active_url) {
- gpu_host_->DidDestroyOffscreenContext(active_url);
+ (*gpu_host_)->DidDestroyOffscreenContext(active_url);
}
void GpuService::DidLoseContext(bool offscreen,
gpu::error::ContextLostReason reason,
const GURL& active_url) {
- gpu_host_->DidLoseContext(offscreen, reason, active_url);
+ (*gpu_host_)->DidLoseContext(offscreen, reason, active_url);
}
void GpuService::StoreShaderToDisk(int client_id,
const std::string& key,
const std::string& shader) {
- gpu_host_->StoreShaderToDisk(client_id, key, shader);
+ (*gpu_host_)->StoreShaderToDisk(client_id, key, shader);
}
#if defined(OS_WIN)
void GpuService::SendAcceleratedSurfaceCreatedChildWindow(
gpu::SurfaceHandle parent_window,
gpu::SurfaceHandle child_window) {
- gpu_host_->SetChildSurface(parent_window, child_window);
+ (*gpu_host_)->SetChildSurface(parent_window, child_window);
}
#endif
« 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