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

Side by Side Diff: components/mus/surfaces/surfaces_context_provider.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 2014 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_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_
6 #define COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11
12 #include "base/macros.h"
13 #include "base/threading/non_thread_safe.h"
14 #include "cc/output/context_provider.h"
15 #include "components/mus/gles2/command_buffer_local_client.h"
16 #include "ui/gfx/native_widget_types.h"
17 #include "ui/gl/gl_surface.h"
18
19 namespace gpu {
20
21 class CommandBufferProxyImpl;
22 struct GpuProcessHostedCALayerTreeParamsMac;
23 class TransferBuffer;
24
25 namespace gles2 {
26 class GLES2CmdHelper;
27 class GLES2Implementation;
28 }
29
30 } // namespace gpu
31
32 namespace ui {
33 class LatencyInfo;
34 }
35
36 namespace mus {
37
38 class CommandBufferDriver;
39 class CommandBufferImpl;
40 class CommandBufferLocal;
41 class GpuState;
42 class SurfacesContextProviderDelegate;
43
44 class SurfacesContextProvider : public cc::ContextProvider,
45 public CommandBufferLocalClient,
46 public base::NonThreadSafe {
47 public:
48 SurfacesContextProvider(gfx::AcceleratedWidget widget,
49 const scoped_refptr<GpuState>& state);
50
51 void SetDelegate(SurfacesContextProviderDelegate* delegate);
52
53 // cc::ContextProvider implementation.
54 bool BindToCurrentThread() override;
55 gpu::gles2::GLES2Interface* ContextGL() override;
56 gpu::ContextSupport* ContextSupport() override;
57 class GrContext* GrContext() override;
58 void InvalidateGrContext(uint32_t state) override;
59 gpu::Capabilities ContextCapabilities() override;
60 void DeleteCachedResources() override {}
61 void SetLostContextCallback(
62 const LostContextCallback& lost_context_callback) override;
63 base::Lock* GetLock() override;
64
65 // SurfacesContextProvider API.
66 void SetSwapBuffersCompletionCallback(
67 gl::GLSurface::SwapCompletionCallback callback);
68
69 protected:
70 friend class base::RefCountedThreadSafe<SurfacesContextProvider>;
71 ~SurfacesContextProvider() override;
72
73 private:
74 // CommandBufferLocalClient:
75 void UpdateVSyncParameters(const base::TimeTicks& timebase,
76 const base::TimeDelta& interval) override;
77 void GpuCompletedSwapBuffers(gfx::SwapResult result) override;
78
79 // Callbacks for CommandBufferProxyImpl:
80 void OnGpuSwapBuffersCompleted(
81 const std::vector<ui::LatencyInfo>& latency_info,
82 gfx::SwapResult result,
83 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac);
84 void OnUpdateVSyncParameters(base::TimeTicks timebase,
85 base::TimeDelta interval);
86
87 bool use_chrome_gpu_command_buffer_;
88
89 // From GLES2Context:
90 // Initialized in BindToCurrentThread.
91 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
92 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_;
93 std::unique_ptr<gpu::gles2::GLES2Implementation> implementation_;
94
95 gpu::Capabilities capabilities_;
96 LostContextCallback lost_context_callback_;
97
98 SurfacesContextProviderDelegate* delegate_;
99 gfx::AcceleratedWidget widget_;
100 CommandBufferLocal* command_buffer_local_;
101 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_proxy_impl_;
102 gl::GLSurface::SwapCompletionCallback swap_buffers_completion_callback_;
103
104 DISALLOW_COPY_AND_ASSIGN(SurfacesContextProvider);
105 };
106
107 } // namespace mus
108
109 #endif // COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_
OLDNEW
« no previous file with comments | « components/mus/surfaces/ozone_gpu_memory_buffer_manager.cc ('k') | components/mus/surfaces/surfaces_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698