ppapi/generators/idl_thunk.py
def _MakeEnterLine(filenode, interface, member, arg, handle_errors, callback,
                   meta):
  """Returns an EnterInstance/EnterResource string for a function."""
  api_name = _StripApiName(interface.GetName()) + '_API'
  if member.GetProperty('api'):  # Override API name.
    manually_provided_api = True
    # TODO(teravest): Automatically guess the API header file.
    api_name = member.GetProperty('api')
  else:
    manually_provided_api = False

  if arg[0] == 'PP_Instance':
    if callback is None:
      arg_string = arg[1]
    else:
      arg_string = '%s, %s' % (arg[1], callback)
    if interface.GetProperty('singleton') or member.GetProperty('singleton'):
      if not manually_provided_api:
        meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
      return 'EnterInstanceAPI<%s> enter(%s);' % (api_name, arg_string)
    else:
      return 'EnterInstance enter(%s);' % arg_string
  elif arg[0] == 'PP_Resource':
    enter_type = 'EnterResource<%s>' % api_name
    if not manually_provided_api:
      meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
    if callback is None:
      return '%s enter(%s, %s);' % (enter_type, arg[1],
                                    str(handle_errors).lower())
    else:
      return '%s enter(%s, %s, %s);' % (enter_type, arg[1],
                                        callback,
                                        str(handle_errors).lower())
  else:
    raise TGenError("Unknown type for _MakeEnterLine: %s" % arg[0])
Returns an EnterInstance/EnterResource string for a function.
Returns an EnterInstance/EnterResource string for a function.
Returns an EnterInstance / EnterResource string for a function .
def _MakeEnterLine(filenode, interface, member, arg, handle_errors, callback,
                   meta):
  api_name = _StripApiName(interface.GetName()) + '_API'
  if member.GetProperty('api'):  
    manually_provided_api = True
    api_name = member.GetProperty('api')
  else:
    manually_provided_api = False
  if arg[0] == 'PP_Instance':
    if callback is None:
      arg_string = arg[1]
    else:
      arg_string = '%s, %s' % (arg[1], callback)
    if interface.GetProperty('singleton') or member.GetProperty('singleton'):
      if not manually_provided_api:
        meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
      return 'EnterInstanceAPI<%s> enter(%s);' % (api_name, arg_string)
    else:
      return 'EnterInstance enter(%s);' % arg_string
  elif arg[0] == 'PP_Resource':
    enter_type = 'EnterResource<%s>' % api_name
    if not manually_provided_api:
      meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode))
    if callback is None:
      return '%s enter(%s, %s);' % (enter_type, arg[1],
                                    str(handle_errors).lower())
    else:
      return '%s enter(%s, %s, %s);' % (enter_type, arg[1],
                                        callback,
                                        str(handle_errors).lower())
  else:
    raise TGenError("Unknown type for _MakeEnterLine: %s" % arg[0])
def _MakeEnterLine ( filenode , interface , member , arg , handle_errors , callback , meta ) : api_name = _StripApiName ( interface . GetName ( ) ) + '_API' if member . GetProperty ( 'api' ) : manually_provided_api = True api_name = member . GetProperty ( 'api' ) else : manually_provided_api = False if arg [ 0 ] == 'PP_Instance' : if callback is None : arg_string = arg [ 1 ] else : arg_string = '%s, %s' % ( arg [ 1 ] , callback ) if interface . GetProperty ( 'singleton' ) or member . GetProperty ( 'singleton' ) : if not manually_provided_api : meta . AddApi ( 'ppapi/thunk/%s_api.h' % _StripFileName ( filenode ) ) return 'EnterInstanceAPI<%s> enter(%s);' % ( api_name , arg_string ) else : return 'EnterInstance enter(%s);' % arg_string elif arg [ 0 ] == 'PP_Resource' : enter_type = 'EnterResource<%s>' % api_name if not manually_provided_api : meta . AddApi ( 'ppapi/thunk/%s_api.h' % _StripFileName ( filenode ) ) if callback is None : return '%s enter(%s, %s);' % ( enter_type , arg [ 1 ] , str ( handle_errors ) . lower ( ) ) else : return '%s enter(%s, %s, %s);' % ( enter_type , arg [ 1 ] , callback , str ( handle_errors ) . lower ( ) ) else : raise TGenError ( "Unknown type for _MakeEnterLine: %s" % arg [ 0 ] )
Returns an EnterInstance/EnterResource string for a function.
Returns an EnterInstance / EnterResource string for a function .
"""Returns an EnterInstance/EnterResource string for a function.""" # Override API name. # TODO(teravest): Automatically guess the API header file.
filenode
interface
member
arg
handle_errors
callback
meta