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

Side by Side Diff: cc/output/context_provider.h

Issue 1985973002: Defer compositor context creation to the thread. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: contextfactory: . 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
« no previous file with comments | « no previous file | cc/output/gl_renderer_unittest.cc » ('j') | cc/test/test_context_provider.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_OUTPUT_CONTEXT_PROVIDER_H_ 5 #ifndef CC_OUTPUT_CONTEXT_PROVIDER_H_
6 #define CC_OUTPUT_CONTEXT_PROVIDER_H_ 6 #define CC_OUTPUT_CONTEXT_PROVIDER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 gpu::gles2::GLES2Interface* ContextGL() { 51 gpu::gles2::GLES2Interface* ContextGL() {
52 return context_provider_->ContextGL(); 52 return context_provider_->ContextGL();
53 } 53 }
54 54
55 private: 55 private:
56 ContextProvider* const context_provider_; 56 ContextProvider* const context_provider_;
57 base::AutoLock context_lock_; 57 base::AutoLock context_lock_;
58 }; 58 };
59 59
60 // Bind the 3d context to the current thread. This should be called before 60 // This Factory class allows deferred creation of a context provider (for eg.
61 // accessing the contexts. Calling it more than once should have no effect. 61 // on another thread than the main thread).
62 // Once this function has been called, the class should only be accessed 62 class Factory {
63 // from the same thread unless the function has some explicitly specified 63 public:
64 // rules for access on a different thread. See SetupLockOnMainThread(), which 64 // Creates and returns a new context provider. The context provider may only
65 // can be used to provide access from multiple threads. 65 // be used on the thread it is created on unless it supports locking (via
66 virtual bool BindToCurrentThread() = 0; 66 // the ScopedContextLock class).
67 virtual scoped_refptr<ContextProvider> CreateContext() = 0;
68 };
67 69
68 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; 70 virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
69 virtual gpu::ContextSupport* ContextSupport() = 0; 71 virtual gpu::ContextSupport* ContextSupport() = 0;
70 virtual class GrContext* GrContext() = 0; 72 virtual class GrContext* GrContext() = 0;
71 73
72 // Invalidates the cached OpenGL state in GrContext. 74 // Invalidates the cached OpenGL state in GrContext.
73 // See skia GrContext::resetContext for details. 75 // See skia GrContext::resetContext for details.
74 virtual void InvalidateGrContext(uint32_t state) = 0; 76 virtual void InvalidateGrContext(uint32_t state) = 0;
75 77
76 // Returns the capabilities of the currently bound 3d context. 78 // Returns the capabilities of the currently bound 3d context.
(...skipping 20 matching lines...) Expand all
97 virtual base::Lock* GetLock() = 0; 99 virtual base::Lock* GetLock() = 0;
98 100
99 protected: 101 protected:
100 friend class base::RefCountedThreadSafe<ContextProvider>; 102 friend class base::RefCountedThreadSafe<ContextProvider>;
101 virtual ~ContextProvider() {} 103 virtual ~ContextProvider() {}
102 }; 104 };
103 105
104 } // namespace cc 106 } // namespace cc
105 107
106 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ 108 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/output/gl_renderer_unittest.cc » ('j') | cc/test/test_context_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698