| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 
| 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 117 | 117 | 
| 118     DISALLOW_COPY_AND_ASSIGN(ShareGroup); | 118     DISALLOW_COPY_AND_ASSIGN(ShareGroup); | 
| 119   }; | 119   }; | 
| 120 | 120 | 
| 121   WebGraphicsContext3DCommandBufferImpl( | 121   WebGraphicsContext3DCommandBufferImpl( | 
| 122       int surface_id, | 122       int surface_id, | 
| 123       const GURL& active_url, | 123       const GURL& active_url, | 
| 124       GpuChannelHost* host, | 124       GpuChannelHost* host, | 
| 125       const Attributes& attributes, | 125       const Attributes& attributes, | 
| 126       bool bind_generates_resources, | 126       bool bind_generates_resources, | 
|  | 127       bool lose_context_when_out_of_memory, | 
| 127       const SharedMemoryLimits& limits, | 128       const SharedMemoryLimits& limits, | 
| 128       WebGraphicsContext3DCommandBufferImpl* share_context); | 129       WebGraphicsContext3DCommandBufferImpl* share_context); | 
| 129 | 130 | 
| 130   virtual ~WebGraphicsContext3DCommandBufferImpl(); | 131   virtual ~WebGraphicsContext3DCommandBufferImpl(); | 
| 131 | 132 | 
| 132   CommandBufferProxyImpl* GetCommandBufferProxy() { | 133   CommandBufferProxyImpl* GetCommandBufferProxy() { | 
| 133     return command_buffer_.get(); | 134     return command_buffer_.get(); | 
| 134   } | 135   } | 
| 135 | 136 | 
| 136   CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); | 137   CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); | 
| 137 | 138 | 
| 138   gpu::gles2::GLES2Implementation* GetImplementation() { | 139   gpu::gles2::GLES2Implementation* GetImplementation() { | 
| 139     return real_gl_.get(); | 140     return real_gl_.get(); | 
| 140   } | 141   } | 
| 141 | 142 | 
| 142   // Return true if GPU process reported context lost or there was a | 143   // Return true if GPU process reported context lost or there was a | 
| 143   // problem communicating with the GPU process. | 144   // problem communicating with the GPU process. | 
| 144   bool IsCommandBufferContextLost(); | 145   bool IsCommandBufferContextLost(); | 
| 145 | 146 | 
| 146   // Create & initialize a WebGraphicsContext3DCommandBufferImpl.  Return NULL | 147   // Create & initialize a WebGraphicsContext3DCommandBufferImpl.  Return NULL | 
| 147   // on any failure. | 148   // on any failure. | 
| 148   static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl* | 149   static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl* | 
| 149       CreateOffscreenContext( | 150       CreateOffscreenContext( | 
| 150           GpuChannelHost* host, | 151           GpuChannelHost* host, | 
| 151           const WebGraphicsContext3D::Attributes& attributes, | 152           const WebGraphicsContext3D::Attributes& attributes, | 
|  | 153           bool lose_context_when_out_of_memory, | 
| 152           const GURL& active_url, | 154           const GURL& active_url, | 
| 153           const SharedMemoryLimits& limits, | 155           const SharedMemoryLimits& limits, | 
| 154           WebGraphicsContext3DCommandBufferImpl* share_context); | 156           WebGraphicsContext3DCommandBufferImpl* share_context); | 
| 155 | 157 | 
| 156   size_t GetMappedMemoryLimit() { | 158   size_t GetMappedMemoryLimit() { | 
| 157     return mem_limits_.mapped_memory_reclaim_limit; | 159     return mem_limits_.mapped_memory_reclaim_limit; | 
| 158   } | 160   } | 
| 159 | 161 | 
| 160   //---------------------------------------------------------------------- | 162   //---------------------------------------------------------------------- | 
| 161   // WebGraphicsContext3D methods | 163   // WebGraphicsContext3D methods | 
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 680     CONTEXT_LOST          = 0x300E | 682     CONTEXT_LOST          = 0x300E | 
| 681   }; | 683   }; | 
| 682   // WebGraphicsContext3DCommandBufferImpl configuration attributes. Those in | 684   // WebGraphicsContext3DCommandBufferImpl configuration attributes. Those in | 
| 683   // the 16-bit range are the same as used by EGL. Those outside the 16-bit | 685   // the 16-bit range are the same as used by EGL. Those outside the 16-bit | 
| 684   // range are unique to Chromium. Attributes are matched using a closest fit | 686   // range are unique to Chromium. Attributes are matched using a closest fit | 
| 685   // algorithm. | 687   // algorithm. | 
| 686   // Changes to this enum should also be copied to | 688   // Changes to this enum should also be copied to | 
| 687   // gpu/command_buffer/common/gles2_cmd_utils.cc and to | 689   // gpu/command_buffer/common/gles2_cmd_utils.cc and to | 
| 688   // gpu/command_buffer/client/gl_in_process_context.cc | 690   // gpu/command_buffer/client/gl_in_process_context.cc | 
| 689   enum Attribute { | 691   enum Attribute { | 
| 690     ALPHA_SIZE                = 0x3021, | 692     ALPHA_SIZE = 0x3021, | 
| 691     BLUE_SIZE                 = 0x3022, | 693     BLUE_SIZE = 0x3022, | 
| 692     GREEN_SIZE                = 0x3023, | 694     GREEN_SIZE = 0x3023, | 
| 693     RED_SIZE                  = 0x3024, | 695     RED_SIZE = 0x3024, | 
| 694     DEPTH_SIZE                = 0x3025, | 696     DEPTH_SIZE = 0x3025, | 
| 695     STENCIL_SIZE              = 0x3026, | 697     STENCIL_SIZE = 0x3026, | 
| 696     SAMPLES                   = 0x3031, | 698     SAMPLES = 0x3031, | 
| 697     SAMPLE_BUFFERS            = 0x3032, | 699     SAMPLE_BUFFERS = 0x3032, | 
| 698     HEIGHT                    = 0x3056, | 700     HEIGHT = 0x3056, | 
| 699     WIDTH                     = 0x3057, | 701     WIDTH = 0x3057, | 
| 700     NONE                      = 0x3038,  // Attrib list = terminator | 702     NONE = 0x3038,  // Attrib list = terminator | 
| 701     SHARE_RESOURCES           = 0x10000, | 703     SHARE_RESOURCES = 0x10000, | 
| 702     BIND_GENERATES_RESOURCES  = 0x10001, | 704     BIND_GENERATES_RESOURCES = 0x10001, | 
| 703     FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002 | 705     FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002, | 
|  | 706     LOSE_CONTEXT_WHEN_OUT_OF_MEMORY = 0x10003, | 
| 704   }; | 707   }; | 
| 705   friend class WebGraphicsContext3DErrorMessageCallback; | 708   friend class WebGraphicsContext3DErrorMessageCallback; | 
| 706 | 709 | 
| 707   // Initialize the underlying GL context. May be called multiple times; second | 710   // Initialize the underlying GL context. May be called multiple times; second | 
| 708   // and subsequent calls are ignored. Must be called from the thread that is | 711   // and subsequent calls are ignored. Must be called from the thread that is | 
| 709   // going to use this object to issue GL commands (which might not be the main | 712   // going to use this object to issue GL commands (which might not be the main | 
| 710   // thread). | 713   // thread). | 
| 711   bool MaybeInitializeGL(); | 714   bool MaybeInitializeGL(); | 
| 712 | 715 | 
| 713   bool InitializeCommandBuffer(bool onscreen, | 716   bool InitializeCommandBuffer(bool onscreen, | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 760 | 763 | 
| 761   bool initialized_; | 764   bool initialized_; | 
| 762   scoped_ptr<CommandBufferProxyImpl> command_buffer_; | 765   scoped_ptr<CommandBufferProxyImpl> command_buffer_; | 
| 763   scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 766   scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 
| 764   scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 767   scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 
| 765   gpu::gles2::GLES2Interface* gl_; | 768   gpu::gles2::GLES2Interface* gl_; | 
| 766   scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_; | 769   scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_; | 
| 767   scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_; | 770   scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_; | 
| 768   Error last_error_; | 771   Error last_error_; | 
| 769   bool bind_generates_resources_; | 772   bool bind_generates_resources_; | 
|  | 773   bool lose_context_when_out_of_memory_; | 
| 770   SharedMemoryLimits mem_limits_; | 774   SharedMemoryLimits mem_limits_; | 
| 771 | 775 | 
| 772   uint32_t flush_id_; | 776   uint32_t flush_id_; | 
| 773   scoped_refptr<ShareGroup> share_group_; | 777   scoped_refptr<ShareGroup> share_group_; | 
| 774 }; | 778 }; | 
| 775 | 779 | 
| 776 }  // namespace content | 780 }  // namespace content | 
| 777 | 781 | 
| 778 #endif  // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 782 #endif  // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 
| OLD | NEW | 
|---|