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

Unified Diff: services/ui/public/cpp/gpu_service.h

Issue 2249413004: services/ui: Allow injecting the IO thread task runner for gpu channel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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/demo/mus_demo.cc ('k') | services/ui/public/cpp/gpu_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/public/cpp/gpu_service.h
diff --git a/services/ui/public/cpp/gpu_service.h b/services/ui/public/cpp/gpu_service.h
index 89290315d65979c664e75bbd5ef7653e9da235fb..bd6fa7082c886ebdb3bf545e0043903d45975190 100644
--- a/services/ui/public/cpp/gpu_service.h
+++ b/services/ui/public/cpp/gpu_service.h
@@ -35,8 +35,11 @@ class GpuService : public gpu::GpuChannelHostFactory,
}
// The GpuService has to be initialized in the main thread before establishing
- // the gpu channel.
- static std::unique_ptr<GpuService> Initialize(shell::Connector* connector);
+ // the gpu channel. If no |task_runner| is provided, then a new thread is
+ // created and used.
+ static std::unique_ptr<GpuService> Create(
+ shell::Connector* connector,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr);
// gpu::GpuChannelEstablishFactory:
void EstablishGpuChannel(
@@ -47,7 +50,8 @@ class GpuService : public gpu::GpuChannelHostFactory,
private:
friend struct base::DefaultSingletonTraits<GpuService>;
- explicit GpuService(shell::Connector* connector);
+ GpuService(shell::Connector* connector,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
scoped_refptr<gpu::GpuChannelHost> GetGpuChannelLocked();
void EstablishGpuChannelOnMainThread();
@@ -65,9 +69,10 @@ class GpuService : public gpu::GpuChannelHostFactory,
size_t size) override;
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
shell::Connector* connector_;
base::WaitableEvent shutdown_event_;
- base::Thread io_thread_;
+ std::unique_ptr<base::Thread> io_thread_;
std::unique_ptr<MojoGpuMemoryBufferManager> gpu_memory_buffer_manager_;
// Lock for |gpu_channel_|, |establish_callbacks_| & |is_establishing_|.
« no previous file with comments | « services/ui/demo/mus_demo.cc ('k') | services/ui/public/cpp/gpu_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698