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

Side by Side Diff: blimp/client/feature/compositor/blimp_context_provider.h

Issue 2241623002: blimp: Move compositing, input and render widget feature to client/core. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments from #7 Created 4 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 BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_
6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11
12 #include "base/macros.h"
13 #include "base/synchronization/lock.h"
14 #include "base/threading/thread_checker.h"
15 #include "cc/output/context_provider.h"
16 #include "gpu/command_buffer/client/gl_in_process_context.h"
17 #include "ui/gl/gl_surface.h"
18
19 namespace skia_bindings {
20 class GrContextForGLES2Interface;
21 } // namespace skia_bindings
22
23 namespace blimp {
24 namespace client {
25
26 // Helper class to provide a graphics context for the compositor.
27 class BlimpContextProvider : public cc::ContextProvider {
28 public:
29 static scoped_refptr<BlimpContextProvider> Create(
30 gfx::AcceleratedWidget widget,
31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
32
33 // cc::ContextProvider implementation.
34 bool BindToCurrentThread() override;
35 void DetachFromThread() override;
36 gpu::Capabilities ContextCapabilities() override;
37 gpu::gles2::GLES2Interface* ContextGL() override;
38 gpu::ContextSupport* ContextSupport() override;
39 class GrContext* GrContext() override;
40 void InvalidateGrContext(uint32_t state) override;
41 base::Lock* GetLock() override;
42 void DeleteCachedResources() override;
43 void SetLostContextCallback(
44 const LostContextCallback& lost_context_callback) override;
45
46 // Gives the GL internal format that should be used for calling CopyTexImage2D
47 // on the default framebuffer.
48 uint32_t GetCopyTextureInternalFormat();
49
50 protected:
51 BlimpContextProvider(
52 gfx::AcceleratedWidget widget,
53 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
54 ~BlimpContextProvider() override;
55
56 private:
57 void OnLostContext();
58
59 base::ThreadChecker main_thread_checker_;
60 base::ThreadChecker context_thread_checker_;
61
62 std::unique_ptr<gpu::GLInProcessContext> context_;
63 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_;
64
65 LostContextCallback lost_context_callback_;
66
67 DISALLOW_COPY_AND_ASSIGN(BlimpContextProvider);
68 };
69
70 } // namespace client
71 } // namespace blimp
72
73 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698