GPU进程的客户端(Browser进程,Render进程)都会创建一个
WebGraphicsContext3DCommandBufferImpl的实例,用于封装与GPU进程的通信。
所以我们从WebGraphicsContext3DCommandBufferImpl开始引出GPU进程的结构。
一.WebGraphicsContext3DCommandBufferImpl的创建。
WebGraphicsContext3D暴露的接口基本与OpenGL ES 2.0 API对应。
WebGraphicsContext3DCommandBufferImpl是WebGraphicsContext3D的实现类。
Browser进程创建WebGraphicsContext3DCommandBufferImpl的实例发生在
CompositorImpl::CreateOutputSurface()。
CompositorImpl::CreateOutputSurface()在创建
WebGraphicsContext3DCommandBufferImpl实例时传入了surface_id。
surface_id标识Browser应用中使用的android标准控件SurfaceView对应的
本地窗口的一块buffer。
Render进程创建WebGraphicsContext3DCommandBufferImpl的实例发生在
RenderWidget::CreateOutputSurface()
RenderWidget::CreateGraphicsContext3D()。
RenderWidget::CreateGraphicsContext3D()在创建
WebGraphicsContext3DCommandBufferImpl实例时传入了surface_id。
surface_id是RenderWidgetHostImpl::RenderWidgetHostImpl()
通过调用GpuSurfaceTracker::Get()->AddSurfaceForRenderer()得到的。
WebGraphicsContext3DCommandBufferImpl的实例,用于封装与GPU进程的通信。
所以我们从WebGraphicsContext3DCommandBufferImpl开始引出GPU进程的结构。
一.WebGraphicsContext3DCommandBufferImpl的创建。
WebGraphicsContext3D暴露的接口基本与OpenGL ES 2.0 API对应。
WebGraphicsContext3DCommandBufferImpl是WebGraphicsContext3D的实现类。
Browser进程创建WebGraphicsContext3DCommandBufferImpl的实例发生在
CompositorImpl::CreateOutputSurface()。
CompositorImpl::CreateOutputSurface()在创建
WebGraphicsContext3DCommandBufferImpl实例时传入了surface_id。
surface_id标识Browser应用中使用的android标准控件SurfaceView对应的
本地窗口的一块buffer。
Render进程创建WebGraphicsContext3DCommandBufferImpl的实例发生在
RenderWidget::CreateOutputSurface()
RenderWidget::CreateGraphicsContext3D()。
RenderWidget::CreateGraphicsContext3D()在创建
WebGraphicsContext3DCommandBufferImpl实例时传入了surface_id。
surface_id是RenderWidgetHostImpl::RenderWidgetHostImpl()
通过调用GpuSurfaceTracker::Get()->AddSurfaceForRenderer()得到的。
通过以下路径传递给RenderWidget::surface_id_。
二.WebGraphicsContext3DCommandBufferImpl中包含的与GPU进程通信相关的成员变量:
scoped_refptr<GpuChannelHost> host_;