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

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: Remove context_provider.mojom 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.
rjkroege 2015/08/06 00:16:21 this file is the replacement for the mojom-ed comm
Fady Samuel 2015/08/06 16:48:23 Yes, added a class level description.
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_
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 class CommandBufferLocal : public gpu::GpuControl {
38 public:
39 class Client {
40 public:
41 virtual ~Client() {}
42 virtual void UpdateVSyncParameters(int64_t timebase, int64_t interval) = 0;
43 virtual void DidLoseContext() = 0;
44 };
45
46 CommandBufferLocal(Client* client,
47 gfx::AcceleratedWidget widget,
48 const scoped_refptr<gles2::GpuState>& gpu_state);
49 ~CommandBufferLocal() override;
50
51 bool Initialize();
52
53 gpu::CommandBuffer* command_buffer() { return command_buffer_.get(); }
54
55 // gpu::GpuControl implementation:
56 gpu::Capabilities GetCapabilities() override;
57 int32_t CreateImage(ClientBuffer buffer,
58 size_t width,
59 size_t height,
60 unsigned internalformat) override;
61 void DestroyImage(int32_t id) override;
62 int32_t CreateGpuMemoryBufferImage(size_t width,
63 size_t height,
64 unsigned internalformat,
65 unsigned usage) override;
66 uint32 InsertSyncPoint() override;
67 uint32 InsertFutureSyncPoint() override;
68 void RetireSyncPoint(uint32 sync_point) override;
69 void SignalSyncPoint(uint32 sync_point,
70 const base::Closure& callback) override;
71 void SignalQuery(uint32 query, const base::Closure& callback) override;
72 void SetSurfaceVisible(bool visible) override;
73 uint32 CreateStreamTexture(uint32 texture_id) override;
74 void SetLock(base::Lock*) override;
75 bool IsGpuChannelLost() override;
76
77 private:
78 void PumpCommands();
79 static scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer(
80 const gfx::Size& size,
81 gfx::GpuMemoryBuffer::Format format);
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