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

Side by Side Diff: components/view_manager/surfaces/command_buffer_local.h

Issue 1245683004: Mandoline: Merge Surfaces and Views apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: August 18 Rebase Created 5 years, 4 months 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
(Empty)
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.
4
5 #ifndef COMPONENTS_VIEW_MANAGER_SURFACES_COMMAND_LOCAL_H_
sky 2015/08/18 17:42:26 COMMAND_BUFFER_LOCAL
Fady Samuel 2015/08/18 19:16:49 Weird. I don't know where BUFFER went. Fixed.
6 #define COMPONENTS_VIEW_MANAGER_SURFACES_COMMAND_LOCAL_H_
7
8 #include <map>
9
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 "gpu/command_buffer/common/command_buffer_shared.h"
16 #include "gpu/command_buffer/service/command_buffer_service.h"
17 #include "ui/gfx/geometry/size.h"
18 #include "ui/gfx/gpu_memory_buffer.h"
19 #include "ui/gfx/native_widget_types.h"
20
21 namespace gpu {
22 class CommandBufferService;
23 class GpuScheduler;
24 class GpuControlService;
25 namespace gles2 {
26 class GLES2Decoder;
27 }
28 }
29
30 namespace gfx {
31 class GLContext;
32 class GLSurface;
33 }
34
35 namespace surfaces {
36
37 // This class provides a thin wrapper around a CommandBufferService and a
38 // GpuControl implementation to allow cc::Display to generate GL directly on
39 // the same thread.
40 class CommandBufferLocal : public gpu::GpuControl {
41 public:
42 class Client {
sky 2015/08/18 17:42:26 move into it's owner header (as chromium style gui
Fady Samuel 2015/08/18 19:16:49 Done.
43 public:
44 virtual ~Client() {}
45 virtual void UpdateVSyncParameters(int64_t timebase, int64_t interval) = 0;
46 virtual void DidLoseContext() = 0;
47 };
48
49 CommandBufferLocal(Client* client,
50 gfx::AcceleratedWidget widget,
51 const scoped_refptr<gles2::GpuState>& gpu_state);
52 ~CommandBufferLocal() override;
53
54 bool Initialize();
55
56 gpu::CommandBuffer* command_buffer() { return command_buffer_.get(); }
57
58 // gpu::GpuControl implementation:
59 gpu::Capabilities GetCapabilities() override;
60 int32_t CreateImage(ClientBuffer buffer,
61 size_t width,
62 size_t height,
63 unsigned internalformat) override;
64 void DestroyImage(int32_t id) override;
65 int32_t CreateGpuMemoryBufferImage(size_t width,
66 size_t height,
67 unsigned internalformat,
68 unsigned usage) override;
69 uint32 InsertSyncPoint() override;
70 uint32 InsertFutureSyncPoint() override;
71 void RetireSyncPoint(uint32 sync_point) override;
72 void SignalSyncPoint(uint32 sync_point,
73 const base::Closure& callback) override;
74 void SignalQuery(uint32 query, const base::Closure& callback) override;
75 void SetSurfaceVisible(bool visible) override;
76 uint32 CreateStreamTexture(uint32 texture_id) override;
77 void SetLock(base::Lock*) override;
78 bool IsGpuChannelLost() override;
79
80 private:
81 void PumpCommands();
82
83 void OnResize(gfx::Size size, float scale_factor);
84 void OnUpdateVSyncParameters(const base::TimeTicks timebase,
85 const base::TimeDelta interval);
86 bool OnWaitSyncPoint(uint32_t sync_point);
87 void OnParseError();
88 void OnContextLost(uint32_t reason);
89 void OnSyncPointRetired();
90
91 gfx::AcceleratedWidget widget_;
92 scoped_refptr<gles2::GpuState> gpu_state_;
93 scoped_ptr<gpu::CommandBufferService> command_buffer_;
94 scoped_ptr<gpu::GpuScheduler> scheduler_;
95 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
96 scoped_refptr<gfx::GLContext> context_;
97 scoped_refptr<gfx::GLSurface> surface_;
98 Client* client_;
99
100 base::WeakPtrFactory<CommandBufferLocal> weak_factory_;
101
102 DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal);
103 };
104
105 } // namespace surfaces
106
107 #endif // COMPONENTS_VIEW_MANAGER_SURFACES_COMMAND_BUFFER_LOCAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698