OLD | NEW |
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 implementation. | 5 // Broker RPC Client implementation. |
6 | 6 |
7 #include "ceee/ie/broker/broker_rpc_client.h" | 7 #include "ceee/ie/broker/broker_rpc_client.h" |
8 | 8 |
9 #include <atlbase.h> | 9 #include <atlbase.h> |
10 #include "base/lock.h" | 10 #include "base/lock.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 template<class Function, class Params> | 162 template<class Function, class Params> |
163 HRESULT BrokerRpcClient::RunRpc(bool allow_restart, | 163 HRESULT BrokerRpcClient::RunRpc(bool allow_restart, |
164 Function rpc_function, | 164 Function rpc_function, |
165 const Params& params) { | 165 const Params& params) { |
166 if (!rpc_function) { | 166 if (!rpc_function) { |
167 RpcDcheck("rpc_function is NULL"); | 167 RpcDcheck("rpc_function is NULL"); |
168 } | 168 } |
169 if (!is_connected()) | 169 if (!is_connected()) { |
| 170 RpcDcheck("BrokerRpcClient is not connected"); |
170 return RPC_E_FAULT; | 171 return RPC_E_FAULT; |
| 172 } |
171 RpcTryExcept { | 173 RpcTryExcept { |
172 DispatchToFunction(rpc_function, params); | 174 DispatchToFunction(rpc_function, params); |
173 return S_OK; | 175 return S_OK; |
174 } RpcExcept(HandleRpcException(RpcExceptionCode())) { | 176 } RpcExcept(HandleRpcException(RpcExceptionCode())) { |
175 LogRpcException("RPC error in RunRpc", RpcExceptionCode()); | 177 LogRpcException("RPC error in RunRpc", RpcExceptionCode()); |
176 | 178 |
177 if (allow_restart && | 179 if (allow_restart && |
178 RPC_S_OK != ::RpcMgmtIsServerListening(binding_handle_)) { | 180 RPC_S_OK != ::RpcMgmtIsServerListening(binding_handle_)) { |
179 Disconnect(); | 181 Disconnect(); |
180 if (SUCCEEDED(Connect(true))) { | 182 if (SUCCEEDED(Connect(true))) { |
(...skipping 21 matching lines...) Expand all Loading... |
202 HRESULT BrokerRpcClient::SendUmaHistogramData(const char* name, | 204 HRESULT BrokerRpcClient::SendUmaHistogramData(const char* name, |
203 int sample, | 205 int sample, |
204 int min, | 206 int min, |
205 int max, | 207 int max, |
206 int bucket_count) { | 208 int bucket_count) { |
207 return RunRpc(allow_restarts_, | 209 return RunRpc(allow_restarts_, |
208 &BrokerRpcClient_SendUmaHistogramData, | 210 &BrokerRpcClient_SendUmaHistogramData, |
209 MakeRefTuple(binding_handle_, name, sample, min, max, | 211 MakeRefTuple(binding_handle_, name, sample, min, max, |
210 bucket_count)); | 212 bucket_count)); |
211 } | 213 } |
OLD | NEW |