Index: ppapi/proxy/ppb_graphics_3d_proxy.cc |
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc |
index 81df45b71ed82b2e2ba0c7fcce52dcb7cd08a2cf..0c21e377733751873561ff42642fd1df3a818fba 100644 |
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc |
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc |
@@ -172,42 +172,24 @@ |
share_gles2 = share_graphics->gles2_impl(); |
} |
- gpu::gles2::ContextCreationAttribHelper attrib_helper; |
std::vector<int32_t> attribs; |
if (attrib_list) { |
- for (const int32_t* attr = attrib_list; attr[0] != PP_GRAPHICS3DATTRIB_NONE; |
+ for (const int32_t* attr = attrib_list; |
+ attr[0] != PP_GRAPHICS3DATTRIB_NONE; |
attr += 2) { |
- switch (attr[0]) { |
- case PP_GRAPHICS3DATTRIB_WIDTH: |
- attrib_helper.offscreen_framebuffer_size.set_width(attr[1]); |
- break; |
- case PP_GRAPHICS3DATTRIB_HEIGHT: |
- attrib_helper.offscreen_framebuffer_size.set_height(attr[1]); |
- break; |
- case PP_GRAPHICS3DATTRIB_GPU_PREFERENCE: |
- attrib_helper.gpu_preference = |
- (attr[1] == PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER) |
- ? gl::PreferIntegratedGpu |
- : gl::PreferDiscreteGpu; |
- break; |
- default: |
- attribs.push_back(attr[0]); |
- attribs.push_back(attr[1]); |
- break; |
- } |
+ attribs.push_back(attr[0]); |
+ attribs.push_back(attr[1]); |
} |
- attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); |
- } |
- if (!attrib_helper.Parse(attribs)) |
- return 0; |
+ } |
+ attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); |
HostResource result; |
gpu::Capabilities capabilities; |
ppapi::proxy::SerializedHandle shared_state; |
gpu::CommandBufferId command_buffer_id; |
- dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create( |
- API_ID_PPB_GRAPHICS_3D, instance, share_host, attrib_helper, &result, |
- &capabilities, &shared_state, &command_buffer_id)); |
+ dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create(API_ID_PPB_GRAPHICS_3D, |
+ instance, share_host, attribs, &result, &capabilities, &shared_state, |
+ &command_buffer_id)); |
if (result.is_null()) |
return 0; |
@@ -258,12 +240,16 @@ |
void PPB_Graphics3D_Proxy::OnMsgCreate( |
PP_Instance instance, |
HostResource share_context, |
- const gpu::gles2::ContextCreationAttribHelper& attrib_helper, |
+ const std::vector<int32_t>& attribs, |
HostResource* result, |
gpu::Capabilities* capabilities, |
SerializedHandle* shared_state, |
gpu::CommandBufferId* command_buffer_id) { |
shared_state->set_null_shmem(); |
+ if (attribs.empty() || |
+ attribs.back() != PP_GRAPHICS3DATTRIB_NONE || |
+ !(attribs.size() & 1)) |
+ return; // Bad message. |
thunk::EnterResourceCreation enter(instance); |
@@ -272,9 +258,13 @@ |
base::SharedMemoryHandle handle = base::SharedMemory::NULLHandle(); |
result->SetHostResource( |
- instance, enter.functions()->CreateGraphics3DRaw( |
- instance, share_context.host_resource(), attrib_helper, |
- capabilities, &handle, command_buffer_id)); |
+ instance, |
+ enter.functions()->CreateGraphics3DRaw(instance, |
+ share_context.host_resource(), |
+ &attribs.front(), |
+ capabilities, |
+ &handle, |
+ command_buffer_id)); |
if (!result->is_null()) { |
shared_state->set_shmem(TransportSHMHandle(dispatcher(), handle), |
sizeof(gpu::CommandBuffer::State)); |