Bug 1651016 - Introduce CACHE_TRY and CACHE_TRY_VAR macros; r=ttung

Differential Revision: https://phabricator.services.mozilla.com/D84316
This commit is contained in:
Jan Varga 2020-07-24 11:47:17 +00:00
parent 39831220cc
commit e2d6a2c2b3
3 changed files with 50 additions and 0 deletions

24
dom/cache/CacheCommon.cpp vendored Normal file
View File

@ -0,0 +1,24 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CacheCommon.h"
#include "nsPrintfCString.h"
#include "nsXPCOM.h"
namespace mozilla::dom::cache {
void HandleError(const nsLiteralCString& aExpr,
const nsLiteralCString& aSourceFile, int32_t aSourceLine) {
#ifdef DEBUG
NS_DebugBreak(NS_DEBUG_WARNING, "Error", aExpr.get(), aSourceFile.get(),
aSourceLine);
#endif
// TODO: Report to browser console
}
} // namespace mozilla::dom::cache

25
dom/cache/CacheCommon.h vendored Normal file
View File

@ -0,0 +1,25 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_cache_CacheCommon_h
#define mozilla_dom_cache_CacheCommon_h
#include "mozilla/dom/quota/QuotaCommon.h"
// Cache equivalent of QM_TRY.
#define CACHE_TRY(...) QM_TRY_META(mozilla::dom::cache, ##__VA_ARGS__)
// Cache equivalent of QM_TRY_VAR.
#define CACHE_TRY_VAR(...) QM_TRY_VAR_META(mozilla::dom::cache, ##__VA_ARGS__)
namespace mozilla::dom::cache {
void HandleError(const nsLiteralCString& aExpr,
const nsLiteralCString& aSourceFile, int32_t aSourceLine);
} // namespace mozilla::dom::cache
#endif // mozilla_dom_cache_CacheCommon_h

1
dom/cache/moz.build vendored
View File

@ -48,6 +48,7 @@ UNIFIED_SOURCES += [
'AutoUtils.cpp',
'Cache.cpp',
'CacheChild.cpp',
'CacheCommon.cpp',
'CacheOpChild.cpp',
'CacheOpParent.cpp',
'CacheParent.cpp',