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

Unified Diff: mojo/nacl/generator/interface_dsl.py

Issue 830593003: Update mojo sdk to rev 9fbbc4f0fef1187312316c0ed992342474e139f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cherry-pick mojo 9d3b8dd17f12d20035a14737fdc38dd926890ff8 Created 5 years, 11 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 | « mojo/nacl/generator/interface.py ('k') | mojo/nacl/mojo_syscall_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/nacl/generator/interface_dsl.py
diff --git a/mojo/nacl/generator/interface_dsl.py b/mojo/nacl/generator/interface_dsl.py
index dfc85aa3914d7d7f85ac56bd9dcd4f96d22eaf18..193cdf2a25110c763d3c5a4c93b54fbd1fc19ee2 100644
--- a/mojo/nacl/generator/interface_dsl.py
+++ b/mojo/nacl/generator/interface_dsl.py
@@ -42,7 +42,7 @@ class Function(object):
def Finalize(self):
self.result_param = Param(self, len(self.params), 'result')
- self.result_param.Out(self.return_type)
+ self.result_param.Out(self.return_type).AlwaysWritten()
class Param(object):
def __init__(self, parent, uid, name, param_type=None):
@@ -56,7 +56,9 @@ class Param(object):
self.is_output = False
self.is_array = False
self.is_struct = False
+ self.is_extensible = False
self.is_optional = False
+ self.is_always_written = False
def GetSizeParam(self):
assert self.size
@@ -76,11 +78,16 @@ class Param(object):
self.is_array = True
return self
- def InStruct(self, ty):
+ # An "extensible" struct is one where we don't know the exact size - rather
+ # the first 4 bytes of the struct declare the length of the struct. This
+ # allows forwards and backwards compatibility with additive changes to the
+ # structure definition.
+ def InExtensibleStruct(self, ty):
self.base_type = ty
self.param_type = 'const struct ' + ty + '*'
self.is_input = True
self.is_struct = True
+ self.is_extensible = True
return self
def InOut(self, ty):
@@ -104,11 +111,26 @@ class Param(object):
self.is_output = True
return self
+ # The size of the struct is fixed by the API, it cannot be extended.
+ def OutFixedStruct(self, ty):
+ self.base_type = ty
+ self.param_type = 'struct ' + ty + '*'
+ self.is_output = True
+ self.is_struct = True
+ self.is_extensible = False
+ return self
+
+ # Declares that it is valid to pass a null pointer.
def Optional(self):
assert not self.IsPassedByValue()
self.is_optional = True
return self
+ def AlwaysWritten(self):
+ assert self.is_output, self
+ self.is_always_written = True
+ return self
+
def IsScalar(self):
return not self.is_array and not self.is_struct
« no previous file with comments | « mojo/nacl/generator/interface.py ('k') | mojo/nacl/mojo_syscall_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698