Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 2692573002: Auto-generate null checks for pointer arguemnts in the passthrough cmd decoder. (Closed)
Patch Set: use nullptr instead of NULL Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers_autogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6c7ac0b5b165dfc4fc94fc891e7fb840484466a1 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 == nullptr) {\n" % self.name)
+ 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)
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers_autogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698