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