зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1436768 - Add debug code to LazyLogModule. r=froydnj
--HG-- extra : rebase_source : bd70f788eb986b73eb70460337d5d7c3423c4e8a extra : source : 82ef13b02416c8519178a7e8e08791b7b8dfcbdb
This commit is contained in:
Родитель
bd7f417d6a
Коммит
572911732c
|
@ -81,8 +81,9 @@ namespace mozilla {
|
||||||
*/
|
*/
|
||||||
class CorruptionCanary {
|
class CorruptionCanary {
|
||||||
public:
|
public:
|
||||||
CorruptionCanary() {
|
constexpr CorruptionCanary()
|
||||||
mValue = kCanarySet;
|
: mValue(kCanarySet)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~CorruptionCanary() {
|
~CorruptionCanary() {
|
||||||
|
|
|
@ -56,6 +56,8 @@ LazyLogModule::operator LogModule*()
|
||||||
mLog = tmp;
|
mLog = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mCanary.Check();
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "mozilla/Atomics.h"
|
#include "mozilla/Atomics.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
|
#include "mozilla/Poison.h"
|
||||||
|
|
||||||
// We normally have logging enabled everywhere, but measurements showed that
|
// We normally have logging enabled everywhere, but measurements showed that
|
||||||
// having logging enabled on Android is quite expensive (hundreds of kilobytes
|
// having logging enabled on Android is quite expensive (hundreds of kilobytes
|
||||||
|
@ -174,6 +175,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* const mLogName;
|
const char* const mLogName;
|
||||||
|
CorruptionCanary mCanary;
|
||||||
Atomic<LogModule*, ReleaseAcquire> mLog;
|
Atomic<LogModule*, ReleaseAcquire> mLog;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче