cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / view_manager / gles2 / command_buffer_local.h
blob87668514b7d20995724035b3e54576345b0b4992
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_VIEW_MANAGER_GLES2_COMMAND_BUFFER_LOCAL_H_
6 #define COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_LOCAL_H_
8 #include <map>
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "components/view_manager/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 gles2 {
36 class CommandBufferLocalClient;
38 // This class provides a thin wrapper around a CommandBufferService and a
39 // GpuControl implementation to allow cc::Display to generate GL directly on
40 // the same thread.
41 class CommandBufferLocal : public gpu::GpuControl {
42 public:
43 CommandBufferLocal(CommandBufferLocalClient* client,
44 gfx::AcceleratedWidget widget,
45 const scoped_refptr<gles2::GpuState>& gpu_state);
46 ~CommandBufferLocal() override;
48 bool Initialize();
50 gpu::CommandBuffer* GetCommandBuffer();
52 // gpu::GpuControl implementation:
53 gpu::Capabilities GetCapabilities() override;
54 int32_t CreateImage(ClientBuffer buffer,
55 size_t width,
56 size_t height,
57 unsigned internalformat) override;
58 void DestroyImage(int32_t id) override;
59 int32_t CreateGpuMemoryBufferImage(size_t width,
60 size_t height,
61 unsigned internalformat,
62 unsigned usage) override;
63 uint32 InsertSyncPoint() override;
64 uint32 InsertFutureSyncPoint() override;
65 void RetireSyncPoint(uint32 sync_point) override;
66 void SignalSyncPoint(uint32 sync_point,
67 const base::Closure& callback) override;
68 void SignalQuery(uint32 query, const base::Closure& callback) override;
69 void SetSurfaceVisible(bool visible) override;
70 uint32 CreateStreamTexture(uint32 texture_id) override;
71 void SetLock(base::Lock*) override;
72 bool IsGpuChannelLost() override;
74 private:
75 void PumpCommands();
77 void OnResize(gfx::Size size, float scale_factor);
78 void OnUpdateVSyncParameters(const base::TimeTicks timebase,
79 const base::TimeDelta interval);
80 bool OnWaitSyncPoint(uint32_t sync_point);
81 void OnParseError();
82 void OnContextLost(uint32_t reason);
83 void OnSyncPointRetired();
85 gfx::AcceleratedWidget widget_;
86 scoped_refptr<gles2::GpuState> gpu_state_;
87 scoped_ptr<gpu::CommandBufferService> command_buffer_;
88 scoped_ptr<gpu::GpuScheduler> scheduler_;
89 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
90 scoped_refptr<gfx::GLContext> context_;
91 scoped_refptr<gfx::GLSurface> surface_;
92 CommandBufferLocalClient* client_;
94 base::WeakPtrFactory<CommandBufferLocal> weak_factory_;
96 DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal);
99 } // namespace gles2
101 #endif // COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_LOCAL_H_