Bug 1215818 - part 3: Add telemetry probe to collect IM share on Linux r?m_kato
Different from Windows and macOS, we cannot check if active keyboard layout
works as "IME" actually. Therefore, this patch add the telemetry probe
to the dispatcher of eCompositionStart. However, composition string is also
used by some Wester keyboard layouts which have dead keys. So, the meaning
of the result is deferent from the other platforms, but it must be useful
information which IM (e.g., fcitx, ibus) is used by most users.
MozReview-Commit-ID: A7vYuGtcrRw
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -1763,16 +1763,33 @@ widget:
expires: never
kind: boolean
notification_emails:
- mnakano@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
+ ime_name_on_linux:
+ bug_numbers:
+ - 1215818
+ description: >
+ Name of active IM (e.g., xim, fcitx, ibus, etc) which was actually set by
+ env on Linux. Different from Windows and macOS, this value includes
+ non-IME users even though this is recoded when first compositionstart
+ event because dead key is also implemented by IME on Linux.
+ keyed: true
+ expires: never
+ kind: boolean
+ notification_emails:
+ - mnakano@mozilla.com
+ release_channel_collection: opt-out
+ record_in_processes:
+ - 'main'
+
# The following section contains memory reporter counters.
memoryreporter:
max_ghost_windows:
bug_numbers:
- 1454724
description: >
The maximum number of leaked ghost windows seen.
expires: "66"
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -9,16 +9,17 @@
#include "IMContextWrapper.h"
#include "nsGtkKeyUtils.h"
#include "nsWindow.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/Likely.h"
#include "mozilla/MiscEvents.h"
#include "mozilla/Preferences.h"
+#include "mozilla/Telemetry.h"
#include "mozilla/TextEventDispatcher.h"
#include "mozilla/TextEvents.h"
#include "WritingModes.h"
namespace mozilla {
namespace widget {
LazyLogModule gGtkIMLog("nsGtkIMModuleWidgets");
@@ -1971,16 +1972,24 @@ IMContextWrapper::DispatchCompositionSta
if (NS_WARN_IF(NS_FAILED(rv))) {
MOZ_LOG(gGtkIMLog, LogLevel::Error,
("0x%p DispatchCompositionStart(), FAILED, "
"due to BeginNativeInputTransaction() failure",
this));
return false;
}
+ static bool sHasSetTelemetry = false;
+ if (!sHasSetTelemetry) {
+ sHasSetTelemetry = true;
+ NS_ConvertUTF8toUTF16 im(GetIMContextName(mIMContextID));
+ Telemetry::ScalarSet(Telemetry::ScalarID::WIDGET_IME_NAME_ON_LINUX,
+ im, true);
+ }
+
MOZ_LOG(gGtkIMLog, LogLevel::Debug,
("0x%p DispatchCompositionStart(), dispatching "
"compositionstart... (mCompositionStart=%u)",
this, mCompositionStart));
mCompositionState = eCompositionState_CompositionStartDispatched;
nsEventStatus status;
dispatcher->StartComposition(status);
if (lastFocusedWindow->IsDestroyed() ||
--- a/widget/gtk/IMContextWrapper.h
+++ b/widget/gtk/IMContextWrapper.h
@@ -123,16 +123,34 @@ public:
return "eScim";
case IMContextID::eUim:
return "eUim";
default:
return "eUnknown";
}
}
+ static const char* GetIMContextName(IMContextID aIMContextID)
+ {
+ switch (aIMContextID) {
+ case IMContextID::eFcitx:
+ return "fcitx";
+ case IMContextID::eIBus:
+ return "ibus";
+ case IMContextID::eIIIMF:
+ return "iiim";
+ case IMContextID::eScim:
+ return "scim";
+ case IMContextID::eUim:
+ return "uim";
+ default:
+ return "<unknown>";
+ }
+ }
+
protected:
~IMContextWrapper();
// Owner of an instance of this class. This should be top level window.
// The owner window must release the contexts when it's destroyed because
// the IME contexts need the native window. If OnDestroyWindow() is called
// with the owner window, it'll release IME contexts. Otherwise, it'll
// just clean up any existing composition if it's related to the destroying