1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_
6 #define MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/timer/timer.h"
10 #include "mojo/public/bindings/remote_ptr.h"
11 #include "mojo/public/system/core_cpp.h"
12 #include "mojom/command_buffer.h"
13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/size.h"
17 class CommandBufferService;
19 class GpuControlService;
28 class CommandBufferImpl : public CommandBuffer {
30 CommandBufferImpl(ScopedCommandBufferClientHandle client,
31 gfx::AcceleratedWidget widget,
32 const gfx::Size& size);
33 virtual ~CommandBufferImpl();
35 virtual void Initialize(ScopedCommandBufferSyncClientHandle sync_client,
36 const ShmHandle& shared_state) OVERRIDE;
37 virtual void SetGetBuffer(int32_t buffer) OVERRIDE;
38 virtual void Flush(int32_t put_offset) OVERRIDE;
39 virtual void MakeProgress(int32_t last_get_offset) OVERRIDE;
40 virtual void RegisterTransferBuffer(int32_t id,
41 const ShmHandle& transfer_buffer,
42 uint32_t size) OVERRIDE;
43 virtual void DestroyTransferBuffer(int32_t id) OVERRIDE;
44 virtual void Echo() OVERRIDE;
46 virtual void RequestAnimationFrames() OVERRIDE;
47 virtual void CancelAnimationFrames() OVERRIDE;
50 bool DoInitialize(const ShmHandle& shared_state);
54 void DrawAnimationFrame();
56 RemotePtr<CommandBufferClient> client_;
57 RemotePtr<CommandBufferSyncClient> sync_client_;
59 gfx::AcceleratedWidget widget_;
61 scoped_ptr<gpu::CommandBufferService> command_buffer_;
62 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
63 scoped_ptr<gpu::GpuScheduler> scheduler_;
64 scoped_ptr<gpu::GpuControlService> gpu_control_;
65 base::RepeatingTimer<CommandBufferImpl> timer_;
67 DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl);
70 } // namespace services
73 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_IMPL_H_