Global Metrics
path: .metrics.halstead.vocabulary
old: 98.0
new: 221.0
path: .metrics.halstead.difficulty
old: 9.807692307692308
new: 22.89
path: .metrics.halstead.estimated_program_length
old: 611.8607967124846
new: 1621.0099038332987
path: .metrics.halstead.n1
old: 7.0
new: 21.0
path: .metrics.halstead.N1
old: 273.0
new: 575.0
path: .metrics.halstead.n2
old: 91.0
new: 200.0
path: .metrics.halstead.length
old: 528.0
new: 1011.0
path: .metrics.halstead.time
old: 1903.0011397685291
new: 10012.555864994392
path: .metrics.halstead.effort
old: 34254.02051583352
new: 180226.00556989905
path: .metrics.halstead.purity_ratio
old: 1.1588272665009178
new: 1.6033728030002954
path: .metrics.halstead.N2
old: 255.0
new: 436.0
path: .metrics.halstead.bugs
old: 0.3515764535284321
new: 1.0635478896463355
path: .metrics.halstead.level
old: 0.10196078431372547
new: 0.043687199650502405
path: .metrics.halstead.volume
old: 3492.56679769283
new: 7873.569487544737
path: .metrics.nexits.sum
old: 1.0
new: 16.0
path: .metrics.nexits.average
old: 0.2
new: 0.6666666666666666
path: .metrics.loc.cloc
old: 5.0
new: 31.0
path: .metrics.loc.lloc
old: 65.0
new: 40.0
path: .metrics.loc.sloc
old: 92.0
new: 359.0
path: .metrics.loc.blank
old: 7.0
new: 82.0
path: .metrics.loc.ploc
old: 80.0
new: 246.0
path: .metrics.nargs.average
old: 0.0
new: 0.75
path: .metrics.nargs.sum
old: 0.0
new: 18.0
path: .metrics.cognitive.average
old: 0.0
new: 0.20833333333333337
path: .metrics.cognitive.sum
old: 0.0
new: 5.0
path: .metrics.cyclomatic.sum
old: 6.0
new: 46.0
path: .metrics.cyclomatic.average
old: 1.0
new: 1.2105263157894737
path: .metrics.nom.total
old: 5.0
new: 24.0
path: .metrics.nom.functions
old: 5.0
new: 24.0
path: .metrics.mi.mi_original
old: 53.943385523469615
new: 18.45958997343747
path: .metrics.mi.mi_sei
old: 20.401789600462
new: -22.401740490113728
path: .metrics.mi.mi_visual_studio
old: 31.545839487409133
new: 10.795081855811388
Spaces Data
Minimal test - lines (342, 357)
path: .spaces[3].metrics.mi.mi_original
old: 86.30256601397451
new: 101.62945356612114
path: .spaces[3].metrics.mi.mi_sei
old: 48.90925187174513
new: 71.02127653548986
path: .spaces[3].metrics.mi.mi_visual_studio
old: 50.4693368502775
new: 59.43242898603575
path: .spaces[3].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[3].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[3].metrics.halstead.n2
old: 41.0
new: 8.0
path: .spaces[3].metrics.halstead.vocabulary
old: 46.0
new: 15.0
path: .spaces[3].metrics.halstead.difficulty
old: 4.695121951219512
new: 4.8125
path: .spaces[3].metrics.halstead.estimated_program_length
old: 231.26927266377825
new: 43.65148445440323
path: .spaces[3].metrics.halstead.n1
old: 5.0
new: 7.0
path: .spaces[3].metrics.halstead.bugs
old: 0.08463289861734552
new: 0.021212372729746045
path: .spaces[3].metrics.halstead.N1
old: 79.0
new: 16.0
path: .spaces[3].metrics.halstead.N2
old: 77.0
new: 11.0
path: .spaces[3].metrics.halstead.length
old: 156.0
new: 27.0
path: .spaces[3].metrics.halstead.level
old: 0.21298701298701295
new: 0.2077922077922078
path: .spaces[3].metrics.halstead.time
old: 224.75957390297037
new: 28.202866487048993
path: .spaces[3].metrics.halstead.volume
old: 861.6756651448941
new: 105.48604608143
path: .spaces[3].metrics.halstead.effort
old: 4045.672330253466
new: 507.6515967668819
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.482495337588322
new: 1.616721646459379
path: .spaces[3].metrics.nexits.average
old: 0.0
new: null
path: .spaces[3].metrics.loc.blank
old: 0.0
new: 5.0
path: .spaces[3].metrics.loc.ploc
old: 21.0
new: 11.0
path: .spaces[3].metrics.loc.lloc
old: 19.0
new: 0.0
path: .spaces[3].metrics.loc.sloc
old: 21.0
new: 16.0
path: .spaces[3].metrics.nargs.average
old: 0.0
new: null
path: .spaces[3].metrics.cognitive.average
old: 0.0
new: null
Code
class nsAndroidBridge final : public nsIAndroidBridge {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIANDROIDBRIDGE
NS_FORWARD_SAFE_NSIANDROIDEVENTDISPATCHER(mEventDispatcher)
nsAndroidBridge();
private:
~nsAndroidBridge();
nsCOMPtr mEventDispatcher;
protected:
};
Minimal test - lines (43, 43)
path: .spaces[0].metrics.nexits.average
old: 0.0
new: null
path: .spaces[0].metrics.mi.mi_sei
old: 64.96734704689862
new: null
path: .spaces[0].metrics.mi.mi_original
old: 97.43318940979545
new: null
path: .spaces[0].metrics.mi.mi_visual_studio
old: 56.97847333906166
new: null
path: .spaces[0].metrics.halstead.vocabulary
old: 30.0
new: 1.0
path: .spaces[0].metrics.halstead.effort
old: 2031.4527065819263
new: 0.0
path: .spaces[0].metrics.halstead.n1
old: 5.0
new: 0.0
path: .spaces[0].metrics.halstead.N1
old: 47.0
new: 0.0
path: .spaces[0].metrics.halstead.time
old: 112.85848369899593
new: 0.0
path: .spaces[0].metrics.halstead.N2
old: 45.0
new: 1.0
path: .spaces[0].metrics.halstead.volume
old: 451.4339347959837
new: 0.0
path: .spaces[0].metrics.halstead.bugs
old: 0.053466680637861336
new: 0.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.3881091871609232
new: null
path: .spaces[0].metrics.halstead.difficulty
old: 4.5
new: 0.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 127.70604521880492
new: null
path: .spaces[0].metrics.halstead.length
old: 92.0
new: 1.0
path: .spaces[0].metrics.halstead.level
old: 0.2222222222222222
new: null
path: .spaces[0].metrics.halstead.n2
old: 25.0
new: 1.0
path: .spaces[0].metrics.loc.lloc
old: 11.0
new: 0.0
path: .spaces[0].metrics.loc.sloc
old: 13.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 13.0
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[0].metrics.nargs.average
old: 0.0
new: null
path: .spaces[0].metrics.nom.total
old: 1.0
new: 0.0
path: .spaces[0].metrics.nom.functions
old: 1.0
new: 0.0
Code
class nsPIDOMWindowOuter;
Minimal test - lines (48, 333)
path: .spaces[2].metrics.loc.lloc
old: 11.0
new: 40.0
path: .spaces[2].metrics.loc.ploc
old: 13.0
new: 205.0
path: .spaces[2].metrics.loc.sloc
old: 13.0
new: 286.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 59.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 22.0
path: .spaces[2].metrics.nargs.average
old: 0.0
new: 0.75
path: .spaces[2].metrics.nargs.sum
old: 0.0
new: 18.0
path: .spaces[2].metrics.nom.functions
old: 1.0
new: 24.0
path: .spaces[2].metrics.nom.total
old: 1.0
new: 24.0
path: .spaces[2].metrics.mi.mi_original
old: 97.43318940979545
new: 23.51177680921947
path: .spaces[2].metrics.mi.mi_visual_studio
old: 56.97847333906166
new: 13.749577081414891
path: .spaces[2].metrics.mi.mi_sei
old: 64.96734704689862
new: -16.67560193045425
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 5.0
path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 0.20833333333333337
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 0.6666666666666666
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 16.0
path: .spaces[2].metrics.halstead.bugs
old: 0.053466680637861336
new: 1.062349383498191
path: .spaces[2].metrics.halstead.N1
old: 47.0
new: 553.0
path: .spaces[2].metrics.halstead.time
old: 112.85848369899593
new: 9995.635994440858
path: .spaces[2].metrics.halstead.length
old: 92.0
new: 954.0
path: .spaces[2].metrics.halstead.effort
old: 2031.4527065819263
new: 179921.44789993545
path: .spaces[2].metrics.halstead.estimated_program_length
old: 127.70604521880492
new: 1342.9872906100431
path: .spaces[2].metrics.halstead.volume
old: 451.4339347959837
new: 7221.642250347724
path: .spaces[2].metrics.halstead.difficulty
old: 4.5
new: 24.914201183431953
path: .spaces[2].metrics.halstead.n1
old: 5.0
new: 21.0
path: .spaces[2].metrics.halstead.level
old: 0.2222222222222222
new: 0.04013775086094288
path: .spaces[2].metrics.halstead.n2
old: 25.0
new: 169.0
path: .spaces[2].metrics.halstead.N2
old: 45.0
new: 401.0
path: .spaces[2].metrics.halstead.vocabulary
old: 30.0
new: 190.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.3881091871609232
new: 1.407743491205496
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 1.2352941176470589
path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 42.0
Code
namespace mozilla {
class AutoLocalJNIFrame;
namespace hal {
class BatteryInformation;
class NetworkInformation;
} // namespace hal
// The order and number of the members in this structure must correspond
// to the attrsAppearance array in GeckoAppShell.getSystemColors()
typedef struct AndroidSystemColors {
nscolor textColorPrimary;
nscolor textColorPrimaryInverse;
nscolor textColorSecondary;
nscolor textColorSecondaryInverse;
nscolor textColorTertiary;
nscolor textColorTertiaryInverse;
nscolor textColorHighlight;
nscolor colorForeground;
nscolor colorBackground;
nscolor panelColorForeground;
nscolor panelColorBackground;
} AndroidSystemColors;
class AndroidBridge final {
public:
enum {
// Values for NotifyIME, in addition to values from the Gecko
// IMEMessage enum; use negative values here to prevent conflict
NOTIFY_IME_OPEN_VKB = -2,
NOTIFY_IME_REPLY_EVENT = -1,
};
enum {
LAYER_CLIENT_TYPE_NONE = 0,
LAYER_CLIENT_TYPE_GL = 2 // AndroidGeckoGLLayerClient
};
static bool IsJavaUiThread() {
return mozilla::jni::GetUIThreadId() == gettid();
}
static void ConstructBridge();
static void DeconstructBridge();
static AndroidBridge* Bridge() { return sBridge; }
bool GetHandlersForURL(const nsAString& aURL,
nsIMutableArray* handlersArray = nullptr,
nsIHandlerApp** aDefaultApp = nullptr,
const nsAString& aAction = u""_ns);
bool GetHandlersForMimeType(const nsAString& aMimeType,
nsIMutableArray* handlersArray = nullptr,
nsIHandlerApp** aDefaultApp = nullptr,
const nsAString& aAction = u""_ns);
bool HasHWVP8Encoder();
bool HasHWVP8Decoder();
bool HasHWH264();
void GetMimeTypeFromExtensions(const nsACString& aFileExt,
nsCString& aMimeType);
void GetExtensionFromMimeType(const nsACString& aMimeType,
nsACString& aFileExt);
gfx::Rect getScreenSize();
int GetScreenDepth();
void Vibrate(const nsTArray& aPattern);
void GetIconForExtension(const nsACString& aFileExt, uint32_t aIconSize,
uint8_t* const aBuf);
bool GetStaticStringField(const char* classID, const char* field,
nsAString& result, JNIEnv* env = nullptr);
bool GetStaticIntField(const char* className, const char* fieldName,
int32_t* aInt, JNIEnv* env = nullptr);
// Returns a global reference to the Context for Fennec's Activity. The
// caller is responsible for ensuring this doesn't leak by calling
// DeleteGlobalRef() when the context is no longer needed.
jobject GetGlobalContextRef(void);
void GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo);
void GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo);
// These methods don't use a ScreenOrientation because it's an
// enum and that would require including the header which requires
// include IPC headers which requires including basictypes.h which
// requires a lot of changes...
uint32_t GetScreenOrientation();
uint16_t GetScreenAngle();
int GetAPIVersion() { return mAPIVersion; }
nsresult GetProxyForURI(const nsACString& aSpec, const nsACString& aScheme,
const nsACString& aHost, const int32_t aPort,
nsACString& aResult);
bool PumpMessageLoop();
// Utility methods.
static jfieldID GetFieldID(JNIEnv* env, jclass jClass, const char* fieldName,
const char* fieldType);
static jfieldID GetStaticFieldID(JNIEnv* env, jclass jClass,
const char* fieldName,
const char* fieldType);
static jmethodID GetMethodID(JNIEnv* env, jclass jClass,
const char* methodName, const char* methodType);
static jmethodID GetStaticMethodID(JNIEnv* env, jclass jClass,
const char* methodName,
const char* methodType);
static jni::Object::LocalRef ChannelCreate(jni::Object::Param);
static void InputStreamClose(jni::Object::Param obj);
static uint32_t InputStreamAvailable(jni::Object::Param obj);
static nsresult InputStreamRead(jni::Object::Param obj, char* aBuf,
uint32_t aCount, uint32_t* aRead);
protected:
static nsTHashMap sStoragePaths;
static AndroidBridge* sBridge;
AndroidBridge();
~AndroidBridge();
int mAPIVersion;
// intput stream
jclass jReadableByteChannel;
jclass jChannels;
jmethodID jChannelCreate;
jmethodID jByteBufferRead;
jclass jInputStream;
jmethodID jClose;
jmethodID jAvailable;
jmethodID jCalculateLength;
// some convinient types to have around
jclass jStringClass;
jni::Object::GlobalRef mMessageQueue;
jfieldID mMessageQueueMessages;
jmethodID mMessageQueueNext;
};
class AutoJNIClass {
private:
JNIEnv* const mEnv;
const jclass mClass;
public:
AutoJNIClass(JNIEnv* jEnv, const char* name)
: mEnv(jEnv), mClass(jni::GetClassRef(jEnv, name)) {}
~AutoJNIClass() { mEnv->DeleteLocalRef(mClass); }
jclass getRawRef() const { return mClass; }
jclass getGlobalRef() const {
return static_cast(mEnv->NewGlobalRef(mClass));
}
jfieldID getField(const char* name, const char* type) const {
return AndroidBridge::GetFieldID(mEnv, mClass, name, type);
}
jfieldID getStaticField(const char* name, const char* type) const {
return AndroidBridge::GetStaticFieldID(mEnv, mClass, name, type);
}
jmethodID getMethod(const char* name, const char* type) const {
return AndroidBridge::GetMethodID(mEnv, mClass, name, type);
}
jmethodID getStaticMethod(const char* name, const char* type) const {
return AndroidBridge::GetStaticMethodID(mEnv, mClass, name, type);
}
};
class AutoJObject {
public:
explicit AutoJObject(JNIEnv* aJNIEnv = nullptr) : mObject(nullptr) {
mJNIEnv = aJNIEnv ? aJNIEnv : jni::GetGeckoThreadEnv();
}
AutoJObject(JNIEnv* aJNIEnv, jobject aObject) {
mJNIEnv = aJNIEnv ? aJNIEnv : jni::GetGeckoThreadEnv();
mObject = aObject;
}
~AutoJObject() {
if (mObject) mJNIEnv->DeleteLocalRef(mObject);
}
jobject operator=(jobject aObject) {
if (mObject) {
mJNIEnv->DeleteLocalRef(mObject);
}
return mObject = aObject;
}
operator jobject() { return mObject; }
private:
JNIEnv* mJNIEnv;
jobject mObject;
};
class AutoLocalJNIFrame {
public:
explicit AutoLocalJNIFrame(int nEntries = 15)
: mEntries(nEntries),
mJNIEnv(jni::GetGeckoThreadEnv()),
mHasFrameBeenPushed(false) {
MOZ_ASSERT(mJNIEnv);
Push();
}
explicit AutoLocalJNIFrame(JNIEnv* aJNIEnv, int nEntries = 15)
: mEntries(nEntries),
mJNIEnv(aJNIEnv ? aJNIEnv : jni::GetGeckoThreadEnv()),
mHasFrameBeenPushed(false) {
MOZ_ASSERT(mJNIEnv);
Push();
}
~AutoLocalJNIFrame() {
if (mHasFrameBeenPushed) {
Pop();
}
}
JNIEnv* GetEnv() { return mJNIEnv; }
bool CheckForException() {
if (mJNIEnv->ExceptionCheck()) {
MOZ_CATCH_JNI_EXCEPTION(mJNIEnv);
return true;
}
return false;
}
// Note! Calling Purge makes all previous local refs created in
// the AutoLocalJNIFrame's scope INVALID; be sure that you locked down
// any local refs that you need to keep around in global refs!
void Purge() {
Pop();
Push();
}
template
ReturnType Pop(ReturnType aResult = nullptr) {
MOZ_ASSERT(mHasFrameBeenPushed);
mHasFrameBeenPushed = false;
return static_cast(
mJNIEnv->PopLocalFrame(static_cast(aResult)));
}
private:
void Push() {
MOZ_ASSERT(!mHasFrameBeenPushed);
// Make sure there is enough space to store a local ref to the
// exception. I am not completely sure this is needed, but does
// not hurt.
if (mJNIEnv->PushLocalFrame(mEntries + 1) != 0) {
CheckForException();
return;
}
mHasFrameBeenPushed = true;
}
const int mEntries;
JNIEnv* const mJNIEnv;
bool mHasFrameBeenPushed;
};
} // namespace mozilla
Minimal test - lines (46, 46)
path: .spaces[1].metrics.loc.sloc
old: 21.0
new: 1.0
path: .spaces[1].metrics.loc.ploc
old: 21.0
new: 1.0
path: .spaces[1].metrics.loc.lloc
old: 19.0
new: 0.0
path: .spaces[1].metrics.nexits.average
old: 0.0
new: null
path: .spaces[1].metrics.cognitive.average
old: 0.0
new: null
path: .spaces[1].metrics.nargs.average
old: 0.0
new: null
path: .spaces[1].metrics.mi.mi_original
old: 86.30256601397451
new: null
path: .spaces[1].metrics.mi.mi_sei
old: 48.90925187174513
new: null
path: .spaces[1].metrics.mi.mi_visual_studio
old: 50.4693368502775
new: null
path: .spaces[1].metrics.halstead.n1
old: 5.0
new: 0.0
path: .spaces[1].metrics.halstead.length
old: 156.0
new: 1.0
path: .spaces[1].metrics.halstead.bugs
old: 0.08463289861734552
new: 0.0
path: .spaces[1].metrics.halstead.difficulty
old: 4.695121951219512
new: 0.0
path: .spaces[1].metrics.halstead.N1
old: 79.0
new: 0.0
path: .spaces[1].metrics.halstead.N2
old: 77.0
new: 1.0
path: .spaces[1].metrics.halstead.effort
old: 4045.672330253466
new: 0.0
path: .spaces[1].metrics.halstead.vocabulary
old: 46.0
new: 1.0
path: .spaces[1].metrics.halstead.volume
old: 861.6756651448941
new: 0.0
path: .spaces[1].metrics.halstead.level
old: 0.21298701298701295
new: null
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.482495337588322
new: null
path: .spaces[1].metrics.halstead.estimated_program_length
old: 231.26927266377825
new: null
path: .spaces[1].metrics.halstead.time
old: 224.75957390297037
new: 0.0
path: .spaces[1].metrics.halstead.n2
old: 41.0
new: 1.0
path: .spaces[1].metrics.nom.functions
old: 1.0
new: 0.0
path: .spaces[1].metrics.nom.total
old: 1.0
new: 0.0
Code
class nsIRunnable;