Chromium Code Reviews| Index: gpu/command_buffer/build_gles2_cmd_buffer.py |
| diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py |
| index 7d04b730c0f950173afb4354efba51ccdfe41e87..4a1ef4a6281693f1c3115e2c980ebbeca8be658f 100755 |
| --- a/gpu/command_buffer/build_gles2_cmd_buffer.py |
| +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py |
| @@ -4996,6 +4996,7 @@ static_assert(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d, |
| """Writes the service implementation for a command.""" |
| self.WritePassthroughServiceFunctionHeader(func, f) |
| self.WriteServiceHandlerArgGetCode(func, f) |
| + func.WritePassthroughHandlerValidation(f) |
| self.WritePassthroughServiceFunctionDoerCall(func, f) |
| f.write(" return error::kNoError;\n") |
| f.write("}\n") |
| @@ -5005,6 +5006,7 @@ static_assert(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d, |
| """Writes the service implementation for a command.""" |
| self.WritePassthroughServiceFunctionHeader(func, f) |
| self.WriteImmediateServiceHandlerArgGetCode(func, f) |
| + func.WritePassthroughHandlerValidation(f) |
| self.WritePassthroughServiceFunctionDoerCall(func, f) |
| f.write(" return error::kNoError;\n") |
| f.write("}\n") |
| @@ -5014,6 +5016,7 @@ static_assert(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d, |
| """Writes the service implementation for a command.""" |
| self.WritePassthroughServiceFunctionHeader(func, f) |
| self.WriteBucketServiceHandlerArgGetCode(func, f) |
| + func.WritePassthroughHandlerValidation(f) |
| self.WritePassthroughServiceFunctionDoerCall(func, f) |
| f.write(" return error::kNoError;\n") |
| f.write("}\n") |
| @@ -8586,6 +8589,10 @@ class Argument(object): |
| """Writes the validation code for an argument.""" |
| pass |
| + def WritePassthroughValidationCode(self, f, func): |
| + """Writes the passthrough validation code for an argument.""" |
| + pass |
| + |
| def WriteClientSideValidationCode(self, f, func): |
| """Writes the validation code for an argument.""" |
| pass |
| @@ -8873,6 +8880,14 @@ class ImmediatePointerArgument(Argument): |
| f.write(" return error::kOutOfBounds;\n") |
| f.write(" }\n") |
| + def WritePassthroughValidationCode(self, f, func): |
| + """Overridden from Argument.""" |
| + if self.optional: |
| + return |
| + f.write(" if (%s == NULL) {\n" % self.name) |
|
Zhenyao Mo
2017/02/10 21:01:23
Can we use nullptr instead?
Geoff Lang
2017/02/13 15:52:24
Done.
|
| + f.write(" return error::kOutOfBounds;\n") |
| + f.write(" }\n") |
| + |
| def GetImmediateVersion(self): |
| """Overridden from Argument.""" |
| return None |
| @@ -9502,6 +9517,11 @@ class Function(object): |
| arg.WriteValidationCode(f, self) |
| self.WriteValidationCode(f) |
| + def WritePassthroughHandlerValidation(self, f): |
| + """Writes validation code for the function.""" |
| + for arg in self.GetOriginalArgs(): |
| + arg.WritePassthroughValidationCode(f, self) |
| + |
| def WriteHandlerImplementation(self, f): |
| """Writes the handler implementation for this command.""" |
| self.type_handler.WriteHandlerImplementation(self, f) |