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_;

本文详细分析了Chromium在Android上GPU进程的结构,包括Browser进程与Render进程如何通过GpuChannelHost与GPU进程通信,以及CommandBufferProxyImpl、GLES2CmdHelper等关键组件的角色和工作流程。在GPU进程中,GLES2DecoderImpl处理来自客户端的命令,实现了GPU进程与客户端的交互。

1121

被折叠的 条评论
为什么被折叠?



