Add 'did_proceed' and 'repeat_visit' to ClientMalwareReportRequest to track CTR.
[chromium-blink-merge.git] / components / mus / gles2 / command_buffer_local.h
blob92a7966110f12220cdb2911b84309feaab675a5d
1 // Copyright 2015 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 COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_
6 #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_
8 #include <map>
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "components/mus/gles2/gpu_state.h"
13 #include "gpu/command_buffer/client/gpu_control.h"
14 #include "gpu/command_buffer/common/command_buffer.h"
15 #include "ui/gfx/geometry/size.h"
16 #include "ui/gfx/gpu_memory_buffer.h"
17 #include "ui/gfx/native_widget_types.h"
19 namespace gpu {
20 class CommandBuffer;
21 class CommandBufferService;
22 class GpuScheduler;
23 class GpuControlService;
24 namespace gles2 {
25 class GLES2Decoder;
29 namespace gfx {
30 class GLContext;
31 class GLSurface;
34 namespace mus {
36 class CommandBufferLocalClient;
37 class GpuState;
39 // This class provides a thin wrapper around a CommandBufferService and a
40 // GpuControl implementation to allow cc::Display to generate GL directly on
41 // the same thread.
42 class CommandBufferLocal : public gpu::GpuControl {
43 public:
44 CommandBufferLocal(CommandBufferLocalClient* client,
45 gfx::AcceleratedWidget widget,
46 const scoped_refptr<GpuState>& gpu_state);
47 ~CommandBufferLocal() override;
49 bool Initialize();
51 gpu::CommandBuffer* GetCommandBuffer();
53 // gpu::GpuControl implementation:
54 gpu::Capabilities GetCapabilities() override;
55 int32_t CreateImage(ClientBuffer buffer,
56 size_t width,
57 size_t height,
58 unsigned internalformat) override;
59 void DestroyImage(int32_t id) override;
60 int32_t CreateGpuMemoryBufferImage(size_t width,
61 size_t height,
62 unsigned internalformat,
63 unsigned usage) override;
64 uint32 InsertSyncPoint() override;
65 uint32 InsertFutureSyncPoint() override;
66 void RetireSyncPoint(uint32 sync_point) override;
67 void SignalSyncPoint(uint32 sync_point,
68 const base::Closure& callback) override;
69 void SignalQuery(uint32 query, const base::Closure& callback) override;
70 void SetSurfaceVisible(bool visible) override;
71 uint32 CreateStreamTexture(uint32 texture_id) override;
72 void SetLock(base::Lock*) override;
73 bool IsGpuChannelLost() override;
74 gpu::CommandBufferNamespace GetNamespaceID() const override;
75 uint64_t GetCommandBufferID() const override;
77 private:
78 void PumpCommands();
80 void OnResize(gfx::Size size, float scale_factor);
81 void OnUpdateVSyncParameters(const base::TimeTicks timebase,
82 const base::TimeDelta interval);
83 bool OnWaitSyncPoint(uint32_t sync_point);
84 void OnParseError();
85 void OnContextLost(uint32_t reason);
86 void OnSyncPointRetired();
88 gfx::AcceleratedWidget widget_;
89 scoped_refptr<GpuState> gpu_state_;
90 scoped_ptr<gpu::CommandBufferService> command_buffer_;
91 scoped_ptr<gpu::GpuScheduler> scheduler_;
92 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
93 scoped_refptr<gfx::GLContext> context_;
94 scoped_refptr<gfx::GLSurface> surface_;
95 CommandBufferLocalClient* client_;
97 base::WeakPtrFactory<CommandBufferLocal> weak_factory_;
99 DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal);
102 } // namespace mus
104 #endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_