OLD | NEW |
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 "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 virtual bool DestroyedOnMainThread() = 0; | 97 virtual bool DestroyedOnMainThread() = 0; |
98 | 98 |
99 // Sets a callback to be called when the context is lost. This should be | 99 // Sets a callback to be called when the context is lost. This should be |
100 // called from the same thread that the context is bound to. To avoid races, | 100 // called from the same thread that the context is bound to. To avoid races, |
101 // it should be called before BindToCurrentThread(), or VerifyContexts() | 101 // it should be called before BindToCurrentThread(), or VerifyContexts() |
102 // should be called after setting the callback. | 102 // should be called after setting the callback. |
103 typedef base::Closure LostContextCallback; | 103 typedef base::Closure LostContextCallback; |
104 virtual void SetLostContextCallback( | 104 virtual void SetLostContextCallback( |
105 const LostContextCallback& lost_context_callback) = 0; | 105 const LostContextCallback& lost_context_callback) = 0; |
106 | 106 |
107 // Sets a callback to be called when the memory policy changes. This should be | |
108 // called from the same thread that the context is bound to. | |
109 typedef base::Callback<void(const ManagedMemoryPolicy& policy)> | |
110 MemoryPolicyChangedCallback; | |
111 virtual void SetMemoryPolicyChangedCallback( | |
112 const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0; | |
113 | |
114 protected: | 107 protected: |
115 friend class base::RefCountedThreadSafe<ContextProvider>; | 108 friend class base::RefCountedThreadSafe<ContextProvider>; |
116 virtual ~ContextProvider() {} | 109 virtual ~ContextProvider() {} |
117 }; | 110 }; |
118 | 111 |
119 } // namespace cc | 112 } // namespace cc |
120 | 113 |
121 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ | 114 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ |
OLD | NEW |