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 WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 5 #ifndef WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ |
6 #define WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 6 #define WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "cc/context_provider.h" | 10 #include "cc/context_provider.h" |
11 | 11 |
12 namespace webkit { | 12 namespace webkit { |
13 namespace gpu { | 13 namespace gpu { |
14 class GrContextForWebGraphicsContext3D; | 14 class GrContextForWebGraphicsContext3D; |
15 | 15 |
16 class ContextProviderInProcess : public cc::ContextProvider { | 16 class ContextProviderInProcess : public cc::ContextProvider { |
17 public: | 17 public: |
18 enum InProcessType { | 18 enum InProcessType { |
19 IN_PROCESS, | 19 IN_PROCESS, |
20 IN_PROCESS_COMMAND_BUFFER, | 20 IN_PROCESS_COMMAND_BUFFER, |
21 }; | 21 }; |
22 explicit ContextProviderInProcess(InProcessType type); | 22 explicit ContextProviderInProcess(InProcessType type); |
23 | 23 |
24 virtual bool InitializeOnMainThread() OVERRIDE; | 24 virtual bool InitializeOnMainThread() OVERRIDE; |
25 virtual bool BindToCurrentThread() OVERRIDE; | 25 virtual bool BindToCurrentThread() OVERRIDE; |
26 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | 26 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; |
27 virtual class GrContext* GrContext() OVERRIDE; | 27 virtual class GrContext* GrContext() OVERRIDE; |
28 virtual void VerifyContexts() OVERRIDE; | 28 virtual void VerifyContexts() OVERRIDE; |
29 | 29 virtual bool DestroyedOnMainThread() OVERRIDE; |
30 bool DestroyedOnMainThread(); | |
31 | 30 |
32 protected: | 31 protected: |
33 virtual ~ContextProviderInProcess(); | 32 virtual ~ContextProviderInProcess(); |
34 | 33 |
35 scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext3d(); | 34 scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext3d(); |
36 | 35 |
37 virtual void OnLostContext(); | 36 virtual void OnLostContext(); |
38 virtual void OnMemoryAllocationChanged(bool nonzero_allocation); | 37 virtual void OnMemoryAllocationChanged(bool nonzero_allocation); |
39 | 38 |
40 private: | 39 private: |
41 InProcessType type_; | 40 InProcessType type_; |
42 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 41 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
43 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; | 42 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; |
44 | 43 |
45 base::Lock destroyed_lock_; | 44 base::Lock destroyed_lock_; |
46 bool destroyed_; | 45 bool destroyed_; |
47 | 46 |
48 class LostContextCallbackProxy; | 47 class LostContextCallbackProxy; |
49 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 48 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
50 | 49 |
51 class MemoryAllocationCallbackProxy; | 50 class MemoryAllocationCallbackProxy; |
52 scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_; | 51 scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_; |
53 }; | 52 }; |
54 | 53 |
55 } // namespace gpu | 54 } // namespace gpu |
56 } // namespace webkit | 55 } // namespace webkit |
57 | 56 |
58 #endif // WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 57 #endif // WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ |
OLD | NEW |