Bug 1179141 - Remove macro |BT_API2_LOGR|, r=joliu

This commit is contained in:
Ben Tian 2015-07-02 15:13:41 +08:00
parent b8a4f7c1e4
commit 9e41c939e8
6 changed files with 11 additions and 45 deletions

View File

@ -77,12 +77,6 @@ extern bool gBluetoothDebugFlag;
#define BT_WARNING(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__)
#endif
/**
* Prints 'R'ELEASE build logs for WebBluetooth API v2.
*/
#define BT_API2_LOGR(msg, ...) \
BT_LOGR("[WEBBT-API2] " msg, ##__VA_ARGS__)
/**
* Wrap literal name and value into a BluetoothNamedValue
* and append it to the array.
@ -141,7 +135,7 @@ extern bool gBluetoothDebugFlag;
#define BT_ENSURE_TRUE_RESOLVE(x, promise, ret) \
do { \
if (MOZ_UNLIKELY(!(x))) { \
BT_API2_LOGR("BT_ENSURE_TRUE_RESOLVE(" #x ") failed"); \
BT_LOGR("BT_ENSURE_TRUE_RESOLVE(" #x ") failed"); \
(promise)->MaybeResolve(ret); \
return (promise).forget(); \
} \
@ -153,7 +147,7 @@ extern bool gBluetoothDebugFlag;
#define BT_ENSURE_TRUE_REJECT(x, promise, ret) \
do { \
if (MOZ_UNLIKELY(!(x))) { \
BT_API2_LOGR("BT_ENSURE_TRUE_REJECT(" #x ") failed"); \
BT_LOGR("BT_ENSURE_TRUE_REJECT(" #x ") failed"); \
(promise)->MaybeReject(ret); \
return (promise).forget(); \
} \

View File

@ -1355,7 +1355,6 @@ BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
int aClientIf,
const BluetoothUuid& aAppUuid)
{
BT_API2_LOGR("Client Registered, clientIf = %d", aClientIf);
MOZ_ASSERT(NS_IsMainThread());
nsString uuid;
@ -1370,8 +1369,7 @@ BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
NS_ENSURE_TRUE_VOID(bs);
if (aStatus != GATT_STATUS_SUCCESS) {
BT_API2_LOGR(
"RegisterClient failed, clientIf = %d, status = %d, appUuid = %s",
BT_LOGD("RegisterClient failed: clientIf = %d, status = %d, appUuid = %s",
aClientIf, aStatus, NS_ConvertUTF16toUTF8(uuid).get());
// Notify BluetoothGatt for client disconnected
@ -1450,7 +1448,6 @@ BluetoothGattManager::ConnectNotification(int aConnId,
int aClientIf,
const nsAString& aDeviceAddr)
{
BT_API2_LOGR();
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
@ -1463,7 +1460,7 @@ BluetoothGattManager::ConnectNotification(int aConnId,
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
if (aStatus != GATT_STATUS_SUCCESS) {
BT_API2_LOGR("Connect failed, clientIf = %d, connId = %d, status = %d",
BT_LOGD("Connect failed: clientIf = %d, connId = %d, status = %d",
aClientIf, aConnId, aStatus);
// Notify BluetoothGatt that the client remains disconnected
@ -1503,7 +1500,6 @@ BluetoothGattManager::DisconnectNotification(int aConnId,
int aClientIf,
const nsAString& aDeviceAddr)
{
BT_API2_LOGR();
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
@ -2030,7 +2026,6 @@ BluetoothGattManager::ReadRemoteRssiNotification(int aClientIf,
int aRssi,
BluetoothGattStatus aStatus)
{
BT_API2_LOGR();
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
@ -2043,9 +2038,9 @@ BluetoothGattManager::ReadRemoteRssiNotification(int aClientIf,
nsRefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
if (aStatus != GATT_STATUS_SUCCESS) { // operation failed
BT_API2_LOGR("ReadRemoteRssi failed, clientIf = %d, bdAddr = %s, " \
"rssi = %d, status = %d", aClientIf,
NS_ConvertUTF16toUTF8(aBdAddr).get(), aRssi, (int)aStatus);
BT_LOGD("ReadRemoteRssi failed: clientIf = %d, bdAddr = %s, rssi = %d, " \
"status = %d", aClientIf, NS_ConvertUTF16toUTF8(aBdAddr).get(),
aRssi, (int)aStatus);
// Reject the read remote rssi request
if (client->mReadRemoteRssiRunnable) {

View File

@ -566,8 +566,6 @@ BluetoothAdapter::StartDiscovery(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BT_API2_LOGR();
// Clear unpaired devices before start discovery
for (int32_t i = mDevices.Length() - 1; i >= 0; i--) {
if (!mDevices[i]->Paired()) {
@ -608,8 +606,6 @@ BluetoothAdapter::StopDiscovery(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BT_API2_LOGR();
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
@ -1193,8 +1189,6 @@ void
BluetoothAdapter::DispatchDeviceEvent(const nsAString& aType,
const BluetoothDeviceEventInit& aInit)
{
BT_API2_LOGR("aType (%s)", NS_ConvertUTF16toUTF8(aType).get());
nsRefPtr<BluetoothDeviceEvent> event =
BluetoothDeviceEvent::Constructor(this, aType, aInit);
DispatchTrustedEvent(event);

View File

@ -248,7 +248,7 @@ BluetoothGatt::DiscoverServices(ErrorResult& aRv)
void
BluetoothGatt::UpdateConnectionState(BluetoothConnectionState aState)
{
BT_API2_LOGR("GATT connection state changes to: %d", int(aState));
BT_LOGR("GATT connection state changes to: %d", int(aState));
mConnectionState = aState;
// Dispatch connectionstatechanged event to application

View File

@ -81,7 +81,6 @@ class GetAdaptersTask : public BluetoothReplyRunnable
const InfallibleTArray<BluetoothNamedValue>& adaptersPropertiesArray =
adaptersProperties.get_ArrayOfBluetoothNamedValue();
BT_API2_LOGR("GetAdaptersTask: len[%d]", adaptersPropertiesArray.Length());
// Append a BluetoothAdapter into adapters array for each properties array
uint32_t numAdapters = adaptersPropertiesArray.Length();
@ -114,7 +113,6 @@ BluetoothManager::BluetoothManager(nsPIDOMWindow *aWindow)
MOZ_ASSERT(aWindow);
RegisterBluetoothSignalHandler(NS_LITERAL_STRING(KEY_MANAGER), this);
BT_API2_LOGR("aWindow %p", aWindow);
// Query adapters list from bluetooth backend
BluetoothService* bs = BluetoothService::Get();
@ -139,8 +137,6 @@ BluetoothManager::DisconnectFromOwner()
BluetoothAdapter*
BluetoothManager::GetDefaultAdapter()
{
BT_API2_LOGR("mDefaultAdapterIndex: %d", mDefaultAdapterIndex);
return DefaultAdapterExists() ? mAdapters[mDefaultAdapterIndex] : nullptr;
}
@ -185,7 +181,6 @@ void
BluetoothManager::HandleAdapterAdded(const BluetoothValue& aValue)
{
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
BT_API2_LOGR();
AppendAdapter(aValue);
@ -230,8 +225,6 @@ BluetoothManager::ReselectDefaultAdapter()
{
// Select the first of existing/remaining adapters as default adapter
mDefaultAdapterIndex = mAdapters.IsEmpty() ? -1 : 0;
BT_API2_LOGR("mAdapters length: %d => NEW mDefaultAdapterIndex: %d",
mAdapters.Length(), mDefaultAdapterIndex);
// Notify application of default adapter change
DispatchAttributeEvent();
@ -241,8 +234,6 @@ void
BluetoothManager::DispatchAdapterEvent(const nsAString& aType,
const BluetoothAdapterEventInit& aInit)
{
BT_API2_LOGR("aType (%s)", NS_ConvertUTF16toUTF8(aType).get());
nsRefPtr<BluetoothAdapterEvent> event =
BluetoothAdapterEvent::Constructor(this, aType, aInit);
DispatchTrustedEvent(event);
@ -252,7 +243,6 @@ void
BluetoothManager::DispatchAttributeEvent()
{
MOZ_ASSERT(NS_IsMainThread());
BT_API2_LOGR();
Sequence<nsString> types;
BT_APPEND_ENUM_STRING_FALLIBLE(types,

View File

@ -23,11 +23,7 @@ BluetoothReplyRunnable::BluetoothReplyRunnable(nsIDOMDOMRequest* aReq,
, mPromise(aPromise)
, mErrorStatus(STATUS_FAIL)
, mName(aName)
{
if (aPromise) {
BT_API2_LOGR("<%s>", NS_ConvertUTF16toUTF8(mName).get());
}
}
{}
void
BluetoothReplyRunnable::SetReply(BluetoothReply* aReply)
@ -61,7 +57,6 @@ BluetoothReplyRunnable::FireReplySuccess(JS::Handle<JS::Value> aVal)
// Promise
if (mPromise) {
BT_API2_LOGR("<%s>", NS_ConvertUTF16toUTF8(mName).get());
mPromise->MaybeResolve(aVal);
}
@ -82,8 +77,6 @@ BluetoothReplyRunnable::FireErrorString()
// Promise
if (mPromise) {
BT_API2_LOGR("<%s>", NS_ConvertUTF16toUTF8(mName).get());
nsresult rv =
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_BLUETOOTH, mErrorStatus);
mPromise->MaybeReject(rv);