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

Unified Diff: mojo/services/gles2/gpu_impl.h

Issue 739493002: Introduce command buffer control thread (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Forward echo too Created 6 years, 1 month 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
Index: mojo/services/gles2/gpu_impl.h
diff --git a/mojo/services/gles2/gpu_impl.h b/mojo/services/gles2/gpu_impl.h
index 62a8af69c5407a8049805dc3c9abc45faf8c7fab..b5e7948c4acb8c444517f9ed19f01a84822b40e3 100644
--- a/mojo/services/gles2/gpu_impl.h
+++ b/mojo/services/gles2/gpu_impl.h
@@ -4,6 +4,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/threading/thread.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/services/public/interfaces/geometry/geometry.mojom.h"
@@ -24,10 +25,30 @@ namespace mojo {
class GpuImpl : public Gpu {
public:
- GpuImpl(InterfaceRequest<Gpu> request,
- const scoped_refptr<gfx::GLShareGroup>& share_group,
- const scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager);
+ // We need to share these across all CommandBuffer instances so that contexts
+ // they create can share resources with each other via mailboxes.
+ class State : public base::RefCounted<State> {
+ public:
+ State();
+
+ scoped_refptr<base::SingleThreadTaskRunner> control_task_runner() {
+ return control_thread_.task_runner();
jamesr 2014/11/19 06:43:02 the threading rules for these objects is not clear
abarth-chromium 2014/11/19 15:42:11 I'm happy to add comments about which thread these
+ }
+ gfx::GLShareGroup* share_group() const { return share_group_.get(); }
+ gpu::gles2::MailboxManager* mailbox_manager() const {
+ return mailbox_manager_.get();
+ }
+
+ private:
+ friend class base::RefCounted<State>;
+ ~State();
+ base::Thread control_thread_;
+ scoped_refptr<gfx::GLShareGroup> share_group_;
+ scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
+ };
+
+ GpuImpl(InterfaceRequest<Gpu> request, const scoped_refptr<State>& state);
~GpuImpl() override;
void CreateOnscreenGLES2Context(
@@ -39,12 +60,8 @@ class GpuImpl : public Gpu {
InterfaceRequest<CommandBuffer> command_buffer_request) override;
private:
- // We need to share these across all CommandBuffer instances so that contexts
- // they create can share resources with each other via mailboxes.
- scoped_refptr<gfx::GLShareGroup> share_group_;
- scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
-
StrongBinding<Gpu> binding_;
+ scoped_refptr<State> state_;
DISALLOW_COPY_AND_ASSIGN(GpuImpl);
};

Powered by Google App Engine
This is Rietveld 408576698