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

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

Issue 1533773002: Delete CC. (Closed) Base URL: git@github.com:domokit/mojo.git@cl-2e
Patch Set: rebase Created 5 years 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/context_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_OUTPUT_CONTEXT_PROVIDER_H_
6 #define CC_OUTPUT_CONTEXT_PROVIDER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "gpu/command_buffer/common/capabilities.h"
11
12 class GrContext;
13
14 namespace base {
15 class Lock;
16 }
17
18 namespace gpu {
19 class ContextSupport;
20 namespace gles2 { class GLES2Interface; }
21 }
22
23 namespace cc {
24 struct ManagedMemoryPolicy;
25
26 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
27 public:
28 // Bind the 3d context to the current thread. This should be called before
29 // accessing the contexts. Calling it more than once should have no effect.
30 // Once this function has been called, the class should only be accessed
31 // from the same thread.
32 virtual bool BindToCurrentThread() = 0;
33 virtual void DetachFromThread() {}
34
35 virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
36 virtual gpu::ContextSupport* ContextSupport() = 0;
37 virtual class GrContext* GrContext() = 0;
38
39 struct Capabilities {
40 gpu::Capabilities gpu;
41 size_t max_transfer_buffer_usage_bytes;
42
43 Capabilities();
44 };
45
46 // Sets up a lock so this context can be used from multiple threads.
47 virtual void SetupLock() = 0;
48
49 // Returns the lock that should be held if using this context from multiple
50 // threads.
51 virtual base::Lock* GetLock() = 0;
52
53 // Returns the capabilities of the currently bound 3d context.
54 virtual Capabilities ContextCapabilities() = 0;
55
56 // Checks if the context is currently known to be lost.
57 virtual bool IsContextLost() = 0;
58
59 // Ask the provider to check if the contexts are valid or lost. If they are,
60 // this should invalidate the provider so that it can be replaced with a new
61 // one.
62 virtual void VerifyContexts() = 0;
63
64 // Delete all cached gpu resources.
65 virtual void DeleteCachedResources() = 0;
66
67 // A method to be called from the main thread that should return true if
68 // the context inside the provider is no longer valid.
69 virtual bool DestroyedOnMainThread() = 0;
70
71 // Sets a callback to be called when the context is lost. This should be
72 // called from the same thread that the context is bound to. To avoid races,
73 // it should be called before BindToCurrentThread(), or VerifyContexts()
74 // should be called after setting the callback.
75 typedef base::Closure LostContextCallback;
76 virtual void SetLostContextCallback(
77 const LostContextCallback& lost_context_callback) = 0;
78
79 // Sets a callback to be called when the memory policy changes. This should be
80 // called from the same thread that the context is bound to.
81 typedef base::Callback<void(const ManagedMemoryPolicy& policy)>
82 MemoryPolicyChangedCallback;
83 virtual void SetMemoryPolicyChangedCallback(
84 const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0;
85
86 protected:
87 friend class base::RefCountedThreadSafe<ContextProvider>;
88 virtual ~ContextProvider() {}
89 };
90
91 } // namespace cc
92
93 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/output/compositor_frame_metadata.cc ('k') | cc/output/context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698