| 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"); | |
| 171 return RPC_E_FAULT; | 170 return RPC_E_FAULT; |
| 172 } | |
| 173 RpcTryExcept { | 171 RpcTryExcept { |
| 174 DispatchToFunction(rpc_function, params); | 172 DispatchToFunction(rpc_function, params); |
| 175 return S_OK; | 173 return S_OK; |
| 176 } RpcExcept(HandleRpcException(RpcExceptionCode())) { | 174 } RpcExcept(HandleRpcException(RpcExceptionCode())) { |
| 177 LogRpcException("RPC error in RunRpc", RpcExceptionCode()); | 175 LogRpcException("RPC error in RunRpc", RpcExceptionCode()); |
| 178 | 176 |
| 179 if (allow_restart && | 177 if (allow_restart && |
| 180 RPC_S_OK != ::RpcMgmtIsServerListening(binding_handle_)) { | 178 RPC_S_OK != ::RpcMgmtIsServerListening(binding_handle_)) { |
| 181 Disconnect(); | 179 Disconnect(); |
| 182 if (SUCCEEDED(Connect(true))) { | 180 if (SUCCEEDED(Connect(true))) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 204 HRESULT BrokerRpcClient::SendUmaHistogramData(const char* name, | 202 HRESULT BrokerRpcClient::SendUmaHistogramData(const char* name, |
| 205 int sample, | 203 int sample, |
| 206 int min, | 204 int min, |
| 207 int max, | 205 int max, |
| 208 int bucket_count) { | 206 int bucket_count) { |
| 209 return RunRpc(allow_restarts_, | 207 return RunRpc(allow_restarts_, |
| 210 &BrokerRpcClient_SendUmaHistogramData, | 208 &BrokerRpcClient_SendUmaHistogramData, |
| 211 MakeRefTuple(binding_handle_, name, sample, min, max, | 209 MakeRefTuple(binding_handle_, name, sample, min, max, |
| 212 bucket_count)); | 210 bucket_count)); |
| 213 } | 211 } |
| OLD | NEW |