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

Unified Diff: ceee/ie/broker/broker_rpc_client.cc

Issue 4989002: Firing event to broker without worker thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ceee/ie/broker/broker_rpc_client.h ('k') | ceee/ie/broker/broker_rpc_lib.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/ie/broker/broker_rpc_client.cc
===================================================================
--- ceee/ie/broker/broker_rpc_client.cc (revision 66617)
+++ ceee/ie/broker/broker_rpc_client.cc (working copy)
@@ -6,8 +6,10 @@
#include "ceee/ie/broker/broker_rpc_client.h"
+#include <atlbase.h>
#include "base/lock.h"
#include "base/logging.h"
+#include "broker_lib.h" // NOLINT
#include "broker_rpc_lib.h" // NOLINT
#include "ceee/common/com_utils.h"
#include "ceee/ie/broker/broker_rpc_utils.h"
@@ -55,16 +57,25 @@
} RpcEndExcept
}
-bool BrokerRpcClient::Connect() {
+HRESULT BrokerRpcClient::StartServer() {
+ // TODO(vitalybuka@google.com): Start broker without COM after the last
+ // COM interface is removed.
+ CComPtr<ICeeeBrokerRegistrar> broker;
+ HRESULT hr = broker.CoCreateInstance(CLSID_CeeeBroker);
+ LOG_IF(ERROR, FAILED(hr)) << "Failed to create broker. " << com::LogHr(hr);
+ return hr;
+}
+
+HRESULT BrokerRpcClient::Connect() {
if (is_connected())
- return true;
+ return S_OK;
std::wstring end_point = GetRpcEndPointAddress();
std::wstring protocol = kRpcProtocol;
DCHECK(!protocol.empty());
DCHECK(!end_point.empty());
if (protocol.empty() || end_point.empty())
- return false;
+ return RPC_E_FAULT;
// TODO(vitalybuka@google.com): There's no guarantee (aside from name
// uniqueness) that it will connect to an endpoint created by the same user.
@@ -94,9 +105,11 @@
LockContext();
}
}
- if (!is_connected())
+ if (!is_connected()) {
Disconnect();
- return is_connected();
+ return RPC_E_FAULT;
+ }
+ return S_OK;
}
void BrokerRpcClient::Disconnect() {
@@ -109,12 +122,13 @@
}
}
-bool BrokerRpcClient::FireEvent(BSTR event_name, BSTR event_args) {
+HRESULT BrokerRpcClient::FireEvent(const char* event_name,
+ const char* event_args) {
RpcTryExcept {
BrokerRpcClient_FireEvent(binding_handle_, event_name, event_args);
- return true;
+ return S_OK;
} RpcExcept(HandleRpcException(RpcExceptionCode())) {
LogRpcException("RPC error in FireEvent", RpcExceptionCode());
} RpcEndExcept
- return false;
+ return RPC_E_FAULT;
}
« no previous file with comments | « ceee/ie/broker/broker_rpc_client.h ('k') | ceee/ie/broker/broker_rpc_lib.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698