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

Side by Side Diff: ceee/ie/broker/broker_rpc_client.h

Issue 5258006: Restart of ceee_broker on crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ceee/ie/broker/broker_rpc_client.cc » ('j') | ceee/ie/broker/broker_rpc_client.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Broker RPC Client. 5 // Broker RPC Client.
6 6
7 #ifndef CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_ 7 #ifndef CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_
8 #define CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_ 8 #define CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_
9 9
10 #include <wtypes.h> 10 #include <wtypes.h>
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 12
13 struct IUnknown;
13 // Interface for sending events. 14 // Interface for sending events.
14 class IEventSender { 15 class IEventSender {
15 public: 16 public:
16 virtual ~IEventSender() {} 17 virtual ~IEventSender() {}
17 virtual HRESULT FireEvent(const char* event_name, 18 virtual HRESULT FireEvent(const char* event_name,
18 const char* event_args) = 0; 19 const char* event_args) = 0;
19 }; 20 };
20 21
21
22 // Class provides communication with BrokerRpcServer. 22 // Class provides communication with BrokerRpcServer.
23 class BrokerRpcClient : public IEventSender { 23 class BrokerRpcClient : public IEventSender {
24 public: 24 public:
25 BrokerRpcClient(); 25 // @param allow_restarts if true client will restart server if it is somehow
26 // gone after successful connecting. Client restarts server one time after
27 // each successful connecting.
28 explicit BrokerRpcClient(bool allow_restarts);
26 virtual ~BrokerRpcClient(); 29 virtual ~BrokerRpcClient();
27 30
28 // Initialize connection with server. 31 // Initialize connection with server.
29 // @param start_server if true method will try to start server if it is 32 // @param start_server if true method will try to start server if it is not
30 // not started yet. Usually only tests pass false here. 33 // started yet. Usually only tests pass false here.
31 virtual HRESULT Connect(bool start_server); 34 virtual HRESULT Connect(bool start_server);
32 35
33 // Relese connection with server 36 // Releases connection with server
34 virtual void Disconnect(); 37 virtual void Disconnect();
35 38
36 // Returns true if object ready for remote calls. 39 // Returns true if object ready for remote calls.
37 virtual bool is_connected() const { 40 virtual bool is_connected() const {
38 return context_ != NULL && binding_handle_ != NULL; 41 return context_ != NULL && binding_handle_ != NULL;
39 } 42 }
40 43
41 // @name Remote calls. 44 // @name Remote calls.
42 // @{ 45 // @{
43 // Calls FireEvent on server side. 46 // Calls FireEvent on server side.
44 virtual HRESULT FireEvent(const char* event_name, const char* event_args); 47 virtual HRESULT FireEvent(const char* event_name, const char* event_args);
45 // Adds UMA to histograms on the server side. Either performance timings or 48 // Adds UMA to histograms on the server side. Either performance timings or
46 // generic histogram. 49 // generic histogram.
47 virtual HRESULT SendUmaHistogramTimes(const char* name, int sample); 50 virtual HRESULT SendUmaHistogramTimes(const char* name, int sample);
48 virtual HRESULT SendUmaHistogramData(const char* name, 51 virtual HRESULT SendUmaHistogramData(const char* name,
49 int sample, 52 int sample,
50 int min, 53 int min,
51 int max, 54 int max,
52 int bucket_count); 55 int bucket_count);
53 // @} 56 // @}
54 57
58 protected:
59 virtual HRESULT StartServer(IUnknown** server);
Sigurður Ásgeirsson 2010/12/01 14:23:54 add comment that this is a unittest seam.
Vitaly Buka corp 2010/12/01 19:06:04 Done.
60
55 private: 61 private:
56 void LockContext(); 62 void LockContext();
57 void ReleaseContext(); 63 void ReleaseContext();
58 64
65 template<class Function, class Params>
66 HRESULT RunRpc(bool allow_restart, Function rpc_function, Params params);
67
59 RPC_BINDING_HANDLE binding_handle_; 68 RPC_BINDING_HANDLE binding_handle_;
60 // Context handle. It is required to make RPC server know number of active 69 // Context handle. It is required to make RPC server know number of active
61 // clients. 70 // clients.
62 void* context_; 71 void* context_;
72 bool allow_restarts_;
63 DISALLOW_COPY_AND_ASSIGN(BrokerRpcClient); 73 DISALLOW_COPY_AND_ASSIGN(BrokerRpcClient);
64 }; 74 };
65 75
66 #endif // CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_ 76 #endif // CEEE_IE_BROKER_BROKER_RPC_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | ceee/ie/broker/broker_rpc_client.cc » ('j') | ceee/ie/broker/broker_rpc_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698