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

Side by Side Diff: mojo/services/gles2/command_buffer_impl.h

Issue 739493002: Introduce command buffer control thread (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Route echo better 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ 5 #ifndef MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_
6 #define MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ 6 #define MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/single_thread_task_runner.h"
9 #include "mojo/public/cpp/bindings/strong_binding.h" 11 #include "mojo/public/cpp/bindings/strong_binding.h"
10 #include "mojo/services/public/interfaces/gpu/command_buffer.mojom.h" 12 #include "mojo/services/public/interfaces/gpu/command_buffer.mojom.h"
11 13
12 namespace mojo { 14 namespace mojo {
13 class CommandBufferDriver; 15 class CommandBufferDriver;
14 16
17 // This class listens to the CommandBuffer message pipe on a low-latency thread
18 // so that we can insert sync points without blocking on the GL driver. It
19 // forwards most method calls to the CommandBufferDriver, which runs on the
20 // same thread as the native viewport.
15 class CommandBufferImpl : public CommandBuffer { 21 class CommandBufferImpl : public CommandBuffer {
16 public: 22 public:
17 CommandBufferImpl(InterfaceRequest<CommandBuffer> request, 23 CommandBufferImpl(
18 scoped_ptr<CommandBufferDriver> driver); 24 InterfaceRequest<CommandBuffer> request,
25 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner,
26 scoped_ptr<CommandBufferDriver> driver);
19 ~CommandBufferImpl() override; 27 ~CommandBufferImpl() override;
20 28
21 void Initialize(CommandBufferSyncClientPtr sync_client, 29 void Initialize(CommandBufferSyncClientPtr sync_client,
22 mojo::ScopedSharedBufferHandle shared_state) override; 30 ScopedSharedBufferHandle shared_state) override;
23 void SetGetBuffer(int32_t buffer) override; 31 void SetGetBuffer(int32_t buffer) override;
24 void Flush(int32_t put_offset) override; 32 void Flush(int32_t put_offset) override;
25 void MakeProgress(int32_t last_get_offset) override; 33 void MakeProgress(int32_t last_get_offset) override;
26 void RegisterTransferBuffer(int32_t id, 34 void RegisterTransferBuffer(int32_t id,
27 mojo::ScopedSharedBufferHandle transfer_buffer, 35 ScopedSharedBufferHandle transfer_buffer,
28 uint32_t size) override; 36 uint32_t size) override;
29 void DestroyTransferBuffer(int32_t id) override; 37 void DestroyTransferBuffer(int32_t id) override;
30 void Echo(const Callback<void()>& callback) override; 38 void Echo(const Callback<void()>& callback) override;
31 39
32 private: 40 private:
41 void BindToRequest(InterfaceRequest<CommandBuffer> request);
33 void OnContextLost(int32_t reason); 42 void OnContextLost(int32_t reason);
34 43
44 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_;
45 scoped_ptr<CommandBufferDriver> driver_;
46
35 StrongBinding<CommandBuffer> binding_; 47 StrongBinding<CommandBuffer> binding_;
36 scoped_ptr<CommandBufferDriver> driver_; 48 base::WeakPtrFactory<CommandBufferImpl> weak_factory_;
37 49
38 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); 50 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl);
39 }; 51 };
40 52
41 } // namespace mojo 53 } // namespace mojo
42 54
43 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ 55 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/services/gles2/command_buffer_driver.cc ('k') | mojo/services/gles2/command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698