зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1306156 - Add telemetry for watching MAU and time spent of WebVR users; r=kip
MozReview-Commit-ID: 6v3F6aGdNK7 --HG-- extra : rebase_source : 6fc6a8accb1cc48968f3e1a09dc76de4b508afc7
This commit is contained in:
Родитель
ad2a95e216
Коммит
96e02d5de5
|
@ -10,6 +10,8 @@
|
|||
#include "nsGlobalWindow.h"
|
||||
#include "VRManagerChild.h"
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -22,9 +24,11 @@ using namespace gfx;
|
|||
*/
|
||||
VREventObserver::VREventObserver(nsGlobalWindow* aGlobalWindow)
|
||||
: mWindow(aGlobalWindow)
|
||||
, mIs2DView(true)
|
||||
{
|
||||
MOZ_ASSERT(aGlobalWindow && aGlobalWindow->IsInnerWindow());
|
||||
|
||||
mSpendTimeIn2DView = TimeStamp::Now();
|
||||
VRManagerChild* vmc = VRManagerChild::Get();
|
||||
if (vmc) {
|
||||
vmc->AddListener(this);
|
||||
|
@ -42,6 +46,14 @@ VREventObserver::DisconnectFromOwner()
|
|||
// In the event that nsGlobalWindow is deallocated, VREventObserver may
|
||||
// still be AddRef'ed elsewhere. Ensure that we don't UAF by
|
||||
// dereferencing mWindow.
|
||||
if (mWindow && mIs2DView) {
|
||||
// The WebVR content is closed, and we will collect the telemetry info
|
||||
// for the users who view it in 2D view only.
|
||||
Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 0);
|
||||
Telemetry::Accumulate(Telemetry::WEBVR_TIME_SPEND_FOR_VIEWING_IN_2D,
|
||||
static_cast<uint32_t>((TimeStamp::Now() - mSpendTimeIn2DView)
|
||||
.ToMilliseconds()));
|
||||
}
|
||||
mWindow = nullptr;
|
||||
|
||||
// Unregister from VRManagerChild
|
||||
|
@ -118,6 +130,10 @@ VREventObserver::NotifyVRDisplayDisconnect(uint32_t aDisplayID)
|
|||
void
|
||||
VREventObserver::NotifyVRDisplayPresentChange(uint32_t aDisplayID)
|
||||
{
|
||||
// When switching to HMD present mode, it is no longer
|
||||
// to be a 2D view.
|
||||
mIs2DView = false;
|
||||
|
||||
if (mWindow && mWindow->AsInner()->IsCurrentInnerWindow()) {
|
||||
mWindow->NotifyActiveVRDisplaysChanged();
|
||||
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript());
|
||||
|
|
|
@ -36,6 +36,10 @@ private:
|
|||
|
||||
// Weak pointer, instance is owned by mWindow.
|
||||
nsGlobalWindow* MOZ_NON_OWNING_REF mWindow;
|
||||
// For WebVR telemetry for tracking users who view content
|
||||
// in the 2D view.
|
||||
TimeStamp mSpendTimeIn2DView;
|
||||
bool mIs2DView;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/dom/GamepadEventTypes.h"
|
||||
#include "mozilla/dom/GamepadBinding.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
/** XXX The DX11 objects and quad blitting could be encapsulated
|
||||
* into a separate object if either Oculus starts supporting
|
||||
|
@ -232,6 +233,7 @@ VROculusSession::StartPresentation(const IntSize& aSize)
|
|||
mPresenting = true;
|
||||
mPresentationSize = aSize;
|
||||
Refresh();
|
||||
mPresentationStart = TimeStamp::Now();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,6 +243,10 @@ VROculusSession::StopPresentation()
|
|||
if (mPresenting) {
|
||||
mLastPresentationEnd = TimeStamp::Now();
|
||||
mPresenting = false;
|
||||
Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 1);
|
||||
Telemetry::Accumulate(Telemetry::WEBVR_TIME_SPEND_FOR_VIEWING_IN_OCULUS,
|
||||
static_cast<uint32_t>((TimeStamp::Now() - mPresentationStart)
|
||||
.ToMilliseconds()));
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ private:
|
|||
TimeStamp mLastShouldQuit;
|
||||
// The timestamp of the last ending presentation
|
||||
TimeStamp mLastPresentationEnd;
|
||||
TimeStamp mPresentationStart;
|
||||
|
||||
~VROculusSession();
|
||||
void Uninitialize(bool aUnloadLib);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/dom/GamepadEventTypes.h"
|
||||
#include "mozilla/dom/GamepadBinding.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
|
@ -268,6 +269,7 @@ VRDisplayOpenVR::StartPresentation()
|
|||
return;
|
||||
}
|
||||
mIsPresenting = true;
|
||||
mPresentationStart = TimeStamp::Now();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -280,6 +282,10 @@ VRDisplayOpenVR::StopPresentation()
|
|||
mVRCompositor->ClearLastSubmittedFrame();
|
||||
|
||||
mIsPresenting = false;
|
||||
Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, 2);
|
||||
Telemetry::Accumulate(Telemetry::WEBVR_TIME_SPEND_FOR_VIEWING_IN_OPENVR,
|
||||
static_cast<uint32_t>((TimeStamp::Now() - mPresentationStart)
|
||||
.ToMilliseconds()));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -321,7 +327,6 @@ VRDisplayOpenVR::SubmitFrame(void* aTextureHandle,
|
|||
}
|
||||
|
||||
mVRCompositor->PostPresentHandoff();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ protected:
|
|||
::vr::IVRChaperone *mVRChaperone;
|
||||
::vr::IVRCompositor *mVRCompositor;
|
||||
|
||||
TimeStamp mPresentationStart;
|
||||
bool mIsPresenting;
|
||||
|
||||
void UpdateStageParameters();
|
||||
|
|
|
@ -13621,5 +13621,48 @@
|
|||
"bug_numbers": [1274919],
|
||||
"description": "Measure the time how long the cursor is hovering before opening the unselcted tab. Only record the data if someone requests for sending unselected tab hover msg.",
|
||||
"releaseChannelCollection": "opt-out"
|
||||
},
|
||||
"WEBVR_USERS_VIEW_IN": {
|
||||
"record_in_processes": ["main", "gpu", "content"],
|
||||
"alert_emails": ["dmu@mozilla.com"],
|
||||
"bug_numbers": [1306156],
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"n_values": 3,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "The amount of users who view VR content in: 2D=0, Oculus=1, OpenVR=2."
|
||||
},
|
||||
"WEBVR_TIME_SPEND_FOR_VIEWING_IN_2D": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"alert_emails": ["dmu@mozilla.com"],
|
||||
"bug_numbers": [1306156],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 50000,
|
||||
"n_buckets": 100,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "The amount of time spend(ms) for users who view VR content in 2D."
|
||||
},
|
||||
"WEBVR_TIME_SPEND_FOR_VIEWING_IN_OCULUS": {
|
||||
"record_in_processes": ["main", "gpu"],
|
||||
"alert_emails": ["dmu@mozilla.com"],
|
||||
"bug_numbers": [1306156],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 50000,
|
||||
"n_buckets": 100,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "The amount of time spend(ms) for users who view VR content in Oculus."
|
||||
},
|
||||
"WEBVR_TIME_SPEND_FOR_VIEWING_IN_OPENVR": {
|
||||
"record_in_processes": ["main", "gpu"],
|
||||
"alert_emails": ["dmu@mozilla.com"],
|
||||
"bug_numbers": [1306156],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": 50000,
|
||||
"n_buckets": 100,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "The amount of time spend(ms) for users who view VR content in OpenVR."
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче