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

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

Issue 5606005: DCHECK to detect invalid BrokerRpcClient usage. (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 | no next file » | no next file with comments »
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 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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698