| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // problem communicating with the GPU process. | 101 // problem communicating with the GPU process. |
| 102 bool IsCommandBufferContextLost(); | 102 bool IsCommandBufferContextLost(); |
| 103 | 103 |
| 104 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL | 104 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL |
| 105 // on any failure. | 105 // on any failure. |
| 106 static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl* | 106 static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl* |
| 107 CreateOffscreenContext( | 107 CreateOffscreenContext( |
| 108 GpuChannelHost* host, | 108 GpuChannelHost* host, |
| 109 const WebGraphicsContext3D::Attributes& attributes, | 109 const WebGraphicsContext3D::Attributes& attributes, |
| 110 const GURL& active_url, | 110 const GURL& active_url, |
| 111 const SharedMemoryLimits& limits); | 111 const SharedMemoryLimits& limits, |
| 112 WebGraphicsContext3D* share_context); |
| 112 | 113 |
| 113 size_t GetMappedMemoryLimit() { | 114 size_t GetMappedMemoryLimit() { |
| 114 return mem_limits_.mapped_memory_reclaim_limit; | 115 return mem_limits_.mapped_memory_reclaim_limit; |
| 115 } | 116 } |
| 116 | 117 |
| 117 //---------------------------------------------------------------------- | 118 //---------------------------------------------------------------------- |
| 118 // WebGraphicsContext3D methods | 119 // WebGraphicsContext3D methods |
| 119 | 120 |
| 120 // Must be called after initialize() and before any of the following methods. | 121 // Must be called after initialize() and before any of the following methods. |
| 121 // Permanently binds to the first calling thread. Returns false if the | 122 // Permanently binds to the first calling thread. Returns false if the |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 SHARE_RESOURCES = 0x10000, | 656 SHARE_RESOURCES = 0x10000, |
| 656 BIND_GENERATES_RESOURCES = 0x10001, | 657 BIND_GENERATES_RESOURCES = 0x10001, |
| 657 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002 | 658 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002 |
| 658 }; | 659 }; |
| 659 friend class WebGraphicsContext3DErrorMessageCallback; | 660 friend class WebGraphicsContext3DErrorMessageCallback; |
| 660 | 661 |
| 661 // Initialize the underlying GL context. May be called multiple times; second | 662 // Initialize the underlying GL context. May be called multiple times; second |
| 662 // and subsequent calls are ignored. Must be called from the thread that is | 663 // and subsequent calls are ignored. Must be called from the thread that is |
| 663 // going to use this object to issue GL commands (which might not be the main | 664 // going to use this object to issue GL commands (which might not be the main |
| 664 // thread). | 665 // thread). |
| 665 bool MaybeInitializeGL(); | 666 bool MaybeInitializeGL(WebGraphicsContext3DCommandBufferImpl* share_context); |
| 666 | 667 |
| 667 bool InitializeCommandBuffer(bool onscreen); | 668 bool InitializeCommandBuffer( |
| 669 bool onscreen, WebGraphicsContext3DCommandBufferImpl* share_context); |
| 668 | 670 |
| 669 void Destroy(); | 671 void Destroy(); |
| 670 | 672 |
| 671 // Create a CommandBufferProxy that renders directly to a view. The view and | 673 // Create a CommandBufferProxy that renders directly to a view. The view and |
| 672 // the associated window must not be destroyed until the returned | 674 // the associated window must not be destroyed until the returned |
| 673 // CommandBufferProxy has been destroyed, otherwise the GPU process might | 675 // CommandBufferProxy has been destroyed, otherwise the GPU process might |
| 674 // attempt to render to an invalid window handle. | 676 // attempt to render to an invalid window handle. |
| 675 // | 677 // |
| 676 // NOTE: on Mac OS X, this entry point is only used to set up the | 678 // NOTE: on Mac OS X, this entry point is only used to set up the |
| 677 // accelerated compositor's output. On this platform, we actually pass | 679 // accelerated compositor's output. On this platform, we actually pass |
| 678 // a gfx::PluginWindowHandle in place of the gfx::NativeViewId, | 680 // a gfx::PluginWindowHandle in place of the gfx::NativeViewId, |
| 679 // because the facility to allocate a fake PluginWindowHandle is | 681 // because the facility to allocate a fake PluginWindowHandle is |
| 680 // already in place. We could add more entry points and messages to | 682 // already in place. We could add more entry points and messages to |
| 681 // allocate both fake PluginWindowHandles and NativeViewIds and map | 683 // allocate both fake PluginWindowHandles and NativeViewIds and map |
| 682 // from fake NativeViewIds to PluginWindowHandles, but this seems like | 684 // from fake NativeViewIds to PluginWindowHandles, but this seems like |
| 683 // unnecessary complexity at the moment. | 685 // unnecessary complexity at the moment. |
| 684 bool CreateContext(bool onscreen); | 686 bool CreateContext( |
| 687 bool onscreen, WebGraphicsContext3DCommandBufferImpl* share_context); |
| 685 | 688 |
| 686 virtual void OnGpuChannelLost(); | 689 virtual void OnGpuChannelLost(); |
| 687 virtual void OnErrorMessage(const std::string& message, int id); | 690 virtual void OnErrorMessage(const std::string& message, int id); |
| 688 | 691 |
| 689 bool initialize_failed_; | 692 bool initialize_failed_; |
| 690 | 693 |
| 691 bool visible_; | 694 bool visible_; |
| 692 | 695 |
| 693 // State needed by MaybeInitializeGL. | 696 // State needed by MaybeInitializeGL. |
| 694 scoped_refptr<GpuChannelHost> host_; | 697 scoped_refptr<GpuChannelHost> host_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 716 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 719 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
| 717 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 720 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
| 718 gpu::gles2::GLES2Interface* gl_; | 721 gpu::gles2::GLES2Interface* gl_; |
| 719 scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_; | 722 scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_; |
| 720 scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_; | 723 scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_; |
| 721 Error last_error_; | 724 Error last_error_; |
| 722 bool bind_generates_resources_; | 725 bool bind_generates_resources_; |
| 723 SharedMemoryLimits mem_limits_; | 726 SharedMemoryLimits mem_limits_; |
| 724 | 727 |
| 725 uint32_t flush_id_; | 728 uint32_t flush_id_; |
| 729 |
| 730 CommandBufferProxyImpl* share_group_; |
| 726 }; | 731 }; |
| 727 | 732 |
| 728 } // namespace content | 733 } // namespace content |
| 729 | 734 |
| 730 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 735 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
| OLD | NEW |