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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « cc/output/compositor_frame_metadata.cc ('k') | cc/output/direct_renderer.cc » ('j') | no next file with comments »
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 "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
11 #include "gpu/command_buffer/common/capabilities.h" 11 #include "gpu/command_buffer/common/capabilities.h"
12 12
13 class GrContext; 13 class GrContext;
14 14
15 namespace base {
16 class Lock;
17 }
18
15 namespace gpu { 19 namespace gpu {
16 class ContextSupport; 20 class ContextSupport;
17 namespace gles2 { class GLES2Interface; } 21 namespace gles2 { class GLES2Interface; }
18 } 22 }
19 23
20 namespace cc { 24 namespace cc {
21 struct ManagedMemoryPolicy; 25 struct ManagedMemoryPolicy;
22 26
23 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { 27 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
24 public: 28 public:
25 // Bind the 3d context to the current thread. This should be called before 29 // Bind the 3d context to the current thread. This should be called before
26 // accessing the contexts. Calling it more than once should have no effect. 30 // accessing the contexts. Calling it more than once should have no effect.
27 // Once this function has been called, the class should only be accessed 31 // Once this function has been called, the class should only be accessed
28 // from the same thread. 32 // from the same thread.
29 virtual bool BindToCurrentThread() = 0; 33 virtual bool BindToCurrentThread() = 0;
34 virtual void DetachFromThread() {}
30 35
31 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; 36 virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
32 virtual gpu::ContextSupport* ContextSupport() = 0; 37 virtual gpu::ContextSupport* ContextSupport() = 0;
33 virtual class GrContext* GrContext() = 0; 38 virtual class GrContext* GrContext() = 0;
34 39
35 struct Capabilities { 40 struct Capabilities {
36 gpu::Capabilities gpu; 41 gpu::Capabilities gpu;
37 size_t max_transfer_buffer_usage_bytes; 42 size_t max_transfer_buffer_usage_bytes;
38 43
39 CC_EXPORT Capabilities(); 44 CC_EXPORT Capabilities();
40 }; 45 };
41 46
47 // Sets up a lock so this context can be used from multiple threads.
48 virtual void SetupLock() = 0;
49
50 // Returns the lock that should be held if using this context from multiple
51 // threads.
52 virtual base::Lock* GetLock() = 0;
53
42 // Returns the capabilities of the currently bound 3d context. 54 // Returns the capabilities of the currently bound 3d context.
43 virtual Capabilities ContextCapabilities() = 0; 55 virtual Capabilities ContextCapabilities() = 0;
44 56
45 // Checks if the context is currently known to be lost. 57 // Checks if the context is currently known to be lost.
46 virtual bool IsContextLost() = 0; 58 virtual bool IsContextLost() = 0;
47 59
48 // Ask the provider to check if the contexts are valid or lost. If they are, 60 // Ask the provider to check if the contexts are valid or lost. If they are,
49 // this should invalidate the provider so that it can be replaced with a new 61 // this should invalidate the provider so that it can be replaced with a new
50 // one. 62 // one.
51 virtual void VerifyContexts() = 0; 63 virtual void VerifyContexts() = 0;
(...skipping 21 matching lines...) Expand all
73 const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0; 85 const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0;
74 86
75 protected: 87 protected:
76 friend class base::RefCountedThreadSafe<ContextProvider>; 88 friend class base::RefCountedThreadSafe<ContextProvider>;
77 virtual ~ContextProvider() {} 89 virtual ~ContextProvider() {}
78 }; 90 };
79 91
80 } // namespace cc 92 } // namespace cc
81 93
82 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ 94 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/output/compositor_frame_metadata.cc ('k') | cc/output/direct_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698