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

Side by Side Diff: cc/test/test_in_process_context_provider.h

Issue 1985973002: Defer compositor context creation to the thread. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ 5 #ifndef CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_
6 #define CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ 6 #define CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 19 matching lines...) Expand all
30 std::unique_ptr<gpu::GLInProcessContext> CreateTestInProcessContext( 30 std::unique_ptr<gpu::GLInProcessContext> CreateTestInProcessContext(
31 TestGpuMemoryBufferManager* gpu_memory_buffer_manager, 31 TestGpuMemoryBufferManager* gpu_memory_buffer_manager,
32 TestImageFactory* image_factory, 32 TestImageFactory* image_factory,
33 gpu::GLInProcessContext* shared_context); 33 gpu::GLInProcessContext* shared_context);
34 34
35 class TestInProcessContextProvider : public ContextProvider { 35 class TestInProcessContextProvider : public ContextProvider {
36 public: 36 public:
37 explicit TestInProcessContextProvider( 37 explicit TestInProcessContextProvider(
38 TestInProcessContextProvider* shared_context); 38 TestInProcessContextProvider* shared_context);
39 39
40 bool BindToCurrentThread() override; 40 class DeferredCreate : public ContextProvider::DeferredCreate {
41 public:
42 explicit DeferredCreate(TestInProcessContextProvider* shared_context)
43 : shared_context_(shared_context) {}
44 scoped_refptr<ContextProvider> CreateContext() override;
45
46 private:
47 TestInProcessContextProvider* shared_context_;
48 };
49
41 gpu::gles2::GLES2Interface* ContextGL() override; 50 gpu::gles2::GLES2Interface* ContextGL() override;
42 gpu::ContextSupport* ContextSupport() override; 51 gpu::ContextSupport* ContextSupport() override;
43 class GrContext* GrContext() override; 52 class GrContext* GrContext() override;
44 void InvalidateGrContext(uint32_t state) override; 53 void InvalidateGrContext(uint32_t state) override;
45 base::Lock* GetLock() override; 54 base::Lock* GetLock() override;
46 gpu::Capabilities ContextCapabilities() override; 55 gpu::Capabilities ContextCapabilities() override;
47 void DeleteCachedResources() override; 56 void DeleteCachedResources() override;
48 void SetLostContextCallback( 57 void SetLostContextCallback(
49 const LostContextCallback& lost_context_callback) override; 58 const LostContextCallback& lost_context_callback) override;
50 59
51 protected: 60 protected:
52 friend class base::RefCountedThreadSafe<TestInProcessContextProvider>; 61 friend class base::RefCountedThreadSafe<TestInProcessContextProvider>;
53 ~TestInProcessContextProvider() override; 62 ~TestInProcessContextProvider() override;
54 63
55 private: 64 private:
56 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; 65 TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
57 TestImageFactory image_factory_; 66 TestImageFactory image_factory_;
58 std::unique_ptr<gpu::GLInProcessContext> context_; 67 std::unique_ptr<gpu::GLInProcessContext> context_;
59 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; 68 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_;
60 base::Lock context_lock_; 69 base::Lock context_lock_;
61 }; 70 };
62 71
63 } // namespace cc 72 } // namespace cc
64 73
65 #endif // CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ 74 #endif // CC_TEST_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698