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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "cc/output/context_cache_controller.h" | 15 #include "cc/output/context_cache_controller.h" |
16 #include "gpu/command_buffer/common/capabilities.h" | 16 #include "gpu/command_buffer/common/capabilities.h" |
17 | 17 |
18 class GrContext; | 18 class GrContext; |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class Lock; | 21 class Lock; |
22 } | 22 } |
23 | 23 |
24 namespace gpu { | 24 namespace gpu { |
25 class ContextSupport; | 25 class ContextSupport; |
26 namespace gles2 { class GLES2Interface; } | 26 namespace gles2 { class GLES2Interface; } |
27 } | 27 } |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 struct ManagedMemoryPolicy; | |
31 | 30 |
32 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { | 31 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { |
33 public: | 32 public: |
34 // Hold an instance of this lock while using a context across multiple | 33 // Hold an instance of this lock while using a context across multiple |
35 // threads. This only works for ContextProviders that will return a valid | 34 // threads. This only works for ContextProviders that will return a valid |
36 // lock from GetLock(), so is not always supported. Most use of | 35 // lock from GetLock(), so is not always supported. Most use of |
37 // ContextProvider should be single-thread only on the thread that | 36 // ContextProvider should be single-thread only on the thread that |
38 // BindToCurrentThread is run on. | 37 // BindToCurrentThread is run on. |
39 class CC_EXPORT ScopedContextLock { | 38 class CC_EXPORT ScopedContextLock { |
40 public: | 39 public: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 virtual base::Lock* GetLock() = 0; | 92 virtual base::Lock* GetLock() = 0; |
94 | 93 |
95 protected: | 94 protected: |
96 friend class base::RefCountedThreadSafe<ContextProvider>; | 95 friend class base::RefCountedThreadSafe<ContextProvider>; |
97 virtual ~ContextProvider() {} | 96 virtual ~ContextProvider() {} |
98 }; | 97 }; |
99 | 98 |
100 } // namespace cc | 99 } // namespace cc |
101 | 100 |
102 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ | 101 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ |
OLD | NEW |