VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py@ 45376

最後變更 在這個檔案從45376是 39288,由 vboxsync 提交於 13 年 前

CrOpenGL: avoid blocked client polling & extra memcpy (block hgsmi command until completion)

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 2.2 KB
 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6import sys
7
8import apiutil
9
10
11apiutil.CopyrightC()
12
13print """
14/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_retval.py SCRIPT */
15#include "chromium.h"
16#include "cr_mem.h"
17#include "cr_net.h"
18#include "server_dispatch.h"
19#include "server.h"
20
21void crServerReturnValue( const void *payload, unsigned int payload_len )
22{
23 CRMessageReadback *rb;
24 int msg_len = sizeof( *rb ) + payload_len;
25
26 /* Don't reply to client if we're loading VM snapshot*/
27 if (cr_server.bIsInLoadingState)
28 return;
29
30 if (cr_server.curClient->conn->type == CR_FILE)
31 {
32 return;
33 }
34
35 rb = (CRMessageReadback *) crAlloc( msg_len );
36
37 rb->header.type = CR_MESSAGE_READBACK;
38 CRDBGPTR_PRINTWB(cr_server.curClient->conn->u32ClientID, &cr_server.writeback_ptr);
39 CRDBGPTR_CHECKNZ(&cr_server.writeback_ptr);
40 CRDBGPTR_CHECKNZ(&cr_server.return_ptr);
41 crMemcpy( &(rb->writeback_ptr), &(cr_server.writeback_ptr), sizeof( rb->writeback_ptr ) );
42 crMemcpy( &(rb->readback_ptr), &(cr_server.return_ptr), sizeof( rb->readback_ptr ) );
43 crMemcpy( rb+1, payload, payload_len );
44 crNetSend( cr_server.curClient->conn, NULL, rb, msg_len );
45 CRDBGPTR_SETZ(&cr_server.writeback_ptr);
46 CRDBGPTR_SETZ(&cr_server.return_ptr);
47 crFree( rb );
48}
49"""
50
51keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
52
53for func_name in keys:
54 params = apiutil.Parameters(func_name)
55 return_type = apiutil.ReturnType(func_name)
56 if apiutil.FindSpecial( "server", func_name ):
57 continue
58 if "VBox" == apiutil.Category(func_name):
59 continue
60 if return_type != 'void':
61 print '%s SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString(params))
62 print '{'
63 print '\t%s retval;' % return_type
64 print '\tretval = cr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params) );
65 print '\tcrServerReturnValue( &retval, sizeof(retval) );'
66 print '\treturn retval; /* WILL PROBABLY BE IGNORED */'
67 print '}'
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette