OLD | NEW |
---|---|
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 |
15 class CommandBufferImpl : public CommandBuffer { | 17 class CommandBufferImpl : public CommandBuffer { |
jamesr
2014/11/19 06:43:02
could use a class level comment
abarth-chromium
2014/11/19 16:54:10
Done.
| |
16 public: | 18 public: |
17 CommandBufferImpl(InterfaceRequest<CommandBuffer> request, | 19 CommandBufferImpl( |
18 scoped_ptr<CommandBufferDriver> driver); | 20 InterfaceRequest<CommandBuffer> request, |
21 scoped_refptr<base::SingleThreadTaskRunner> control_task_runner, | |
22 scoped_ptr<CommandBufferDriver> driver); | |
19 ~CommandBufferImpl() override; | 23 ~CommandBufferImpl() override; |
20 | 24 |
21 void Initialize(CommandBufferSyncClientPtr sync_client, | 25 void Initialize(CommandBufferSyncClientPtr sync_client, |
22 mojo::ScopedSharedBufferHandle shared_state) override; | 26 ScopedSharedBufferHandle shared_state) override; |
23 void SetGetBuffer(int32_t buffer) override; | 27 void SetGetBuffer(int32_t buffer) override; |
24 void Flush(int32_t put_offset) override; | 28 void Flush(int32_t put_offset) override; |
25 void MakeProgress(int32_t last_get_offset) override; | 29 void MakeProgress(int32_t last_get_offset) override; |
26 void RegisterTransferBuffer(int32_t id, | 30 void RegisterTransferBuffer(int32_t id, |
27 mojo::ScopedSharedBufferHandle transfer_buffer, | 31 ScopedSharedBufferHandle transfer_buffer, |
28 uint32_t size) override; | 32 uint32_t size) override; |
29 void DestroyTransferBuffer(int32_t id) override; | 33 void DestroyTransferBuffer(int32_t id) override; |
30 void Echo(const Callback<void()>& callback) override; | 34 void Echo(const Callback<void()>& callback) override; |
31 | 35 |
32 private: | 36 private: |
37 void BindToRequest(InterfaceRequest<CommandBuffer> request); | |
33 void OnContextLost(int32_t reason); | 38 void OnContextLost(int32_t reason); |
34 | 39 |
35 StrongBinding<CommandBuffer> binding_; | 40 scoped_refptr<base::SingleThreadTaskRunner> driver_task_runner_; |
36 scoped_ptr<CommandBufferDriver> driver_; | 41 scoped_ptr<CommandBufferDriver> driver_; |
37 | 42 |
43 scoped_ptr<StrongBinding<CommandBuffer>> binding_; | |
jamesr
2014/11/19 06:43:02
hmm, no inherent need to have a scoped_ptr<> to th
abarth-chromium
2014/11/19 15:42:11
Sure thing.
| |
44 base::WeakPtrFactory<CommandBufferImpl> weak_factory_; | |
45 | |
38 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); | 46 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl); |
39 }; | 47 }; |
40 | 48 |
41 } // namespace mojo | 49 } // namespace mojo |
42 | 50 |
43 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ | 51 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |