THRIFT-1485 Performance: pass large and/or refcounted arguments as "const"
Patch: Jens Geyer
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1228965 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/delphi/src/Thrift.Server.pas b/lib/delphi/src/Thrift.Server.pas
index 2d35c19..d437527 100644
--- a/lib/delphi/src/Thrift.Server.pas
+++ b/lib/delphi/src/Thrift.Server.pas
@@ -37,7 +37,7 @@
TServerImpl = class abstract( TInterfacedObject, IServer )
public
type
- TLogDelegate = reference to procedure( str: string);
+ TLogDelegate = reference to procedure( const str: string);
protected
FProcessor : IProcessor;
FServerTransport : IServerTransport;
@@ -47,41 +47,43 @@
FOutputProtocolFactory : IProtocolFactory;
FLogDelegate : TLogDelegate;
- class procedure DefaultLogDelegate( str: string);
+ class procedure DefaultLogDelegate( const str: string);
procedure Serve; virtual; abstract;
procedure Stop; virtual; abstract;
public
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- AInputTransportFactory : ITransportFactory;
- AOutputTransportFactory : ITransportFactory;
- AInputProtocolFactory : IProtocolFactory;
- AOutputProtocolFactory : IProtocolFactory;
- ALogDelegate : TLogDelegate
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const AInputTransportFactory : ITransportFactory;
+ const AOutputTransportFactory : ITransportFactory;
+ const AInputProtocolFactory : IProtocolFactory;
+ const AOutputProtocolFactory : IProtocolFactory;
+ const ALogDelegate : TLogDelegate
); overload;
- constructor Create( AProcessor :IProcessor;
- AServerTransport: IServerTransport); overload;
+ constructor Create(
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport
+ ); overload;
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- ALogDelegate: TLogDelegate
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const ALogDelegate: TLogDelegate
); overload;
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- ATransportFactory : ITransportFactory
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const ATransportFactory : ITransportFactory
); overload;
constructor Create(
- AProcessor :IProcessor;
- AServerTransport: IServerTransport;
- ATransportFactory : ITransportFactory;
- AProtocolFactory : IProtocolFactory
+ const AProcessor :IProcessor;
+ const AServerTransport: IServerTransport;
+ const ATransportFactory : ITransportFactory;
+ const AProtocolFactory : IProtocolFactory
); overload;
end;
@@ -89,13 +91,13 @@
private
FStop : Boolean;
public
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport); overload;
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport); overload;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
ALogDel: TServerImpl.TLogDelegate); overload;
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport;
- ATransportFactory: ITransportFactory); overload;
- constructor Create( AProcessor: IProcessor; AServerTransport: IServerTransport;
- ATransportFactory: ITransportFactory; AProtocolFactory: IProtocolFactory); overload;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
+ const ATransportFactory: ITransportFactory); overload;
+ constructor Create( const AProcessor: IProcessor; const AServerTransport: IServerTransport;
+ const ATransportFactory: ITransportFactory; const AProtocolFactory: IProtocolFactory); overload;
procedure Serve; override;
procedure Stop; override;
@@ -106,8 +108,8 @@
{ TServerImpl }
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ALogDelegate: TLogDelegate);
+constructor TServerImpl.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ALogDelegate: TLogDelegate);
var
InputFactory, OutputFactory : IProtocolFactory;
InputTransFactory, OutputTransFactory : ITransportFactory;
@@ -129,8 +131,8 @@
);
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport);
+constructor TServerImpl.Create(const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport);
var
InputFactory, OutputFactory : IProtocolFactory;
InputTransFactory, OutputTransFactory : ITransportFactory;
@@ -152,8 +154,8 @@
);
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory);
+constructor TServerImpl.Create(const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory);
var
InputProtocolFactory : IProtocolFactory;
OutputProtocolFactory : IProtocolFactory;
@@ -165,11 +167,11 @@
InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; AInputTransportFactory,
- AOutputTransportFactory: ITransportFactory; AInputProtocolFactory,
- AOutputProtocolFactory: IProtocolFactory;
- ALogDelegate : TLogDelegate);
+constructor TServerImpl.Create(const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport;
+ const AInputTransportFactory, AOutputTransportFactory: ITransportFactory;
+ const AInputProtocolFactory, AOutputProtocolFactory: IProtocolFactory;
+ const ALogDelegate : TLogDelegate);
begin
FProcessor := AProcessor;
FServerTransport := AServerTransport;
@@ -180,14 +182,14 @@
FLogDelegate := ALogDelegate;
end;
-class procedure TServerImpl.DefaultLogDelegate( str: string);
+class procedure TServerImpl.DefaultLogDelegate( const str: string);
begin
Writeln( str );
end;
-constructor TServerImpl.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory;
- AProtocolFactory: IProtocolFactory);
+constructor TServerImpl.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
+ const AProtocolFactory: IProtocolFactory);
begin
Create( AProcessor, AServerTransport,
ATransportFactory, ATransportFactory,
@@ -197,8 +199,8 @@
{ TSimpleServer }
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport);
var
InputProtocolFactory : IProtocolFactory;
OutputProtocolFactory : IProtocolFactory;
@@ -214,8 +216,8 @@
OutputTransportFactory, InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
end;
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ALogDel: TServerImpl.TLogDelegate);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; ALogDel: TServerImpl.TLogDelegate);
var
InputProtocolFactory : IProtocolFactory;
OutputProtocolFactory : IProtocolFactory;
@@ -231,16 +233,16 @@
OutputTransportFactory, InputProtocolFactory, OutputProtocolFactory, ALogDel);
end;
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory);
begin
inherited Create( AProcessor, AServerTransport, ATransportFactory,
ATransportFactory, TBinaryProtocolImpl.TFactory.Create, TBinaryProtocolImpl.TFactory.Create, DefaultLogDelegate);
end;
-constructor TSimpleServer.Create(AProcessor: IProcessor;
- AServerTransport: IServerTransport; ATransportFactory: ITransportFactory;
- AProtocolFactory: IProtocolFactory);
+constructor TSimpleServer.Create( const AProcessor: IProcessor;
+ const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
+ const AProtocolFactory: IProtocolFactory);
begin
inherited Create( AProcessor, AServerTransport, ATransportFactory,
ATransportFactory, AProtocolFactory, AProtocolFactory, DefaultLogDelegate);