Index: ceee/ie/broker/broker_rpc_client.h |
=================================================================== |
--- ceee/ie/broker/broker_rpc_client.h (revision 67905) |
+++ ceee/ie/broker/broker_rpc_client.h (working copy) |
@@ -10,6 +10,7 @@ |
#include <wtypes.h> |
#include "base/basictypes.h" |
+struct IUnknown; |
// Interface for sending events. |
class IEventSender { |
public: |
@@ -18,19 +19,21 @@ |
const char* event_args) = 0; |
}; |
- |
// Class provides communication with BrokerRpcServer. |
class BrokerRpcClient : public IEventSender { |
public: |
- BrokerRpcClient(); |
+ // @param allow_restarts if true client will restart server if it is somehow |
+ // gone after successful connecting. Client restarts server one time after |
+ // each successful connecting. |
+ explicit BrokerRpcClient(bool allow_restarts); |
virtual ~BrokerRpcClient(); |
// Initialize connection with server. |
- // @param start_server if true method will try to start server if it is |
- // not started yet. Usually only tests pass false here. |
+ // @param start_server if true method will try to start server if it is not |
+ // started yet. Usually only tests pass false here. |
virtual HRESULT Connect(bool start_server); |
- // Relese connection with server |
+ // Releases connection with server |
virtual void Disconnect(); |
// Returns true if object ready for remote calls. |
@@ -52,14 +55,24 @@ |
int bucket_count); |
// @} |
+ protected: |
+ // Starts ceee broker process. This is unittest seam. |
+ virtual HRESULT StartServer(IUnknown** server); |
+ |
private: |
void LockContext(); |
void ReleaseContext(); |
+ template<class Function, class Params> |
+ HRESULT RunRpc(bool allow_restart, |
+ Function rpc_function, |
+ const Params& params); |
+ |
RPC_BINDING_HANDLE binding_handle_; |
// Context handle. It is required to make RPC server know number of active |
// clients. |
void* context_; |
+ bool allow_restarts_; |
DISALLOW_COPY_AND_ASSIGN(BrokerRpcClient); |
}; |