| 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 CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER | 5 #ifndef WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 
| 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER | 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 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |  | 
| 12 | 11 | 
| 13 namespace webkit { | 12 namespace webkit { | 
| 14 namespace gpu { | 13 namespace gpu { | 
| 15 class GrContextForWebGraphicsContext3D; | 14 class GrContextForWebGraphicsContext3D; | 
| 16 } |  | 
| 17 } |  | 
| 18 | 15 | 
| 19 namespace content { | 16 class ContextProviderInProcess : public cc::ContextProvider { | 
| 20 |  | 
| 21 // Implementation of cc::ContextProvider that provides a |  | 
| 22 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. |  | 
| 23 class ContextProviderCommandBuffer : public cc::ContextProvider { |  | 
| 24  public: | 17  public: | 
| 25   ContextProviderCommandBuffer(); | 18   enum InProcessType { | 
|  | 19     IN_PROCESS, | 
|  | 20     IN_PROCESS_COMMAND_BUFFER, | 
|  | 21   }; | 
|  | 22   explicit ContextProviderInProcess(InProcessType type); | 
| 26 | 23 | 
| 27   virtual bool InitializeOnMainThread() OVERRIDE; | 24   virtual bool InitializeOnMainThread() OVERRIDE; | 
| 28   virtual bool BindToCurrentThread() OVERRIDE; | 25   virtual bool BindToCurrentThread() OVERRIDE; | 
| 29   virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE; | 26   virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | 
| 30   virtual class GrContext* GrContext() OVERRIDE; | 27   virtual class GrContext* GrContext() OVERRIDE; | 
| 31   virtual void VerifyContexts() OVERRIDE; | 28   virtual void VerifyContexts() OVERRIDE; | 
| 32 | 29 | 
| 33   bool DestroyedOnMainThread(); | 30   bool DestroyedOnMainThread(); | 
| 34 | 31 | 
| 35  protected: | 32  protected: | 
| 36   virtual ~ContextProviderCommandBuffer(); | 33   virtual ~ContextProviderInProcess(); | 
| 37 | 34 | 
| 38   // Subclass must provide an implementation to create an offscreen context. | 35   scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext3d(); | 
| 39   virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |  | 
| 40       CreateOffscreenContext3d() = 0; |  | 
| 41 | 36 | 
| 42   virtual void OnLostContext(); | 37   virtual void OnLostContext(); | 
| 43   virtual void OnMemoryAllocationChanged(bool nonzero_allocation); | 38   virtual void OnMemoryAllocationChanged(bool nonzero_allocation); | 
| 44 | 39 | 
| 45  private: | 40  private: | 
| 46 | 41   InProcessType type_; | 
| 47   scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; | 42   scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 
| 48   scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; | 43   scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; | 
| 49 | 44 | 
| 50   base::Lock destroyed_lock_; | 45   base::Lock destroyed_lock_; | 
| 51   bool destroyed_; | 46   bool destroyed_; | 
| 52 | 47 | 
| 53   class LostContextCallbackProxy; | 48   class LostContextCallbackProxy; | 
| 54   scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 49   scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 
| 55 | 50 | 
| 56   class MemoryAllocationCallbackProxy; | 51   class MemoryAllocationCallbackProxy; | 
| 57   scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_; | 52   scoped_ptr<MemoryAllocationCallbackProxy> memory_allocation_callback_proxy_; | 
| 58 }; | 53 }; | 
| 59 | 54 | 
| 60 }  // namespace content | 55 }  // namespace gpu | 
|  | 56 }  // namespace webkit | 
| 61 | 57 | 
| 62 #endif  // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER | 58 #endif  // WEBKIT_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 
| OLD | NEW | 
|---|