mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Add Telemetry for the drawing models that plugins use. (bug 1229961 part 1, r=aklotz,vladan)
--HG-- extra : rebase_source : 235694f543026a0b55d8ed65bb1489a3cf97b04d
This commit is contained in:
parent
a67ee2ad2f
commit
d8db9b6470
@ -125,6 +125,7 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
|
||||
, mIsWhitelistedForShumway(false)
|
||||
, mWindowType(NPWindowTypeWindow)
|
||||
, mDrawingModel(kDefaultDrawingModel)
|
||||
, mLastRecordedDrawingModel(-1)
|
||||
, mFrameID(0)
|
||||
#if defined(OS_WIN)
|
||||
, mPluginHWND(nullptr)
|
||||
@ -809,6 +810,8 @@ PluginInstanceParent::SetCurrentImage(Image* aImage)
|
||||
nsAutoTArray<ImageContainer::NonOwningImage,1> imageList;
|
||||
imageList.AppendElement(holder);
|
||||
mImageContainer->SetCurrentImages(imageList);
|
||||
|
||||
RecordDrawingModel();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -973,6 +976,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
|
||||
PLUGIN_LOG_DEBUG((" (RecvShow invalidated for surface %p)",
|
||||
mFrontSurface.get()));
|
||||
|
||||
RecordDrawingModel();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1380,6 +1384,7 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
RecordDrawingModel();
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
@ -2363,3 +2368,28 @@ PluginInstanceParent::Cast(NPP aInstance, PluginAsyncSurrogate** aSurrogate)
|
||||
return instancePtr;
|
||||
}
|
||||
|
||||
void
|
||||
PluginInstanceParent::RecordDrawingModel()
|
||||
{
|
||||
int mode = -1;
|
||||
switch (mWindowType) {
|
||||
case NPWindowTypeWindow:
|
||||
// We use 0=windowed since there is no specific NPDrawingModel value.
|
||||
mode = 0;
|
||||
break;
|
||||
case NPWindowTypeDrawable:
|
||||
mode = mDrawingModel + 1;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("bad window type");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == mLastRecordedDrawingModel) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(mode >= 0);
|
||||
|
||||
Telemetry::Accumulate(Telemetry::PLUGIN_DRAWING_MODEL, mode);
|
||||
mLastRecordedDrawingModel = mode;
|
||||
}
|
||||
|
@ -376,6 +376,9 @@ private:
|
||||
|
||||
void SetCurrentImage(layers::Image* aImage);
|
||||
|
||||
// Update Telemetry with the current drawing model.
|
||||
void RecordDrawingModel();
|
||||
|
||||
private:
|
||||
PluginModuleParent* mParent;
|
||||
RefPtr<PluginAsyncSurrogate> mSurrogate;
|
||||
@ -387,6 +390,11 @@ private:
|
||||
NPWindowType mWindowType;
|
||||
int16_t mDrawingModel;
|
||||
|
||||
// Since plugins may request different drawing models to find a compatible
|
||||
// one, we only record the drawing model after a SetWindow call and if the
|
||||
// drawing model has changed.
|
||||
int mLastRecordedDrawingModel;
|
||||
|
||||
nsDataHashtable<nsPtrHashKey<NPObject>, PluginScriptableObjectParent*> mScriptableObjects;
|
||||
|
||||
// This is used to tell the compositor that it should invalidate the ImageLayer.
|
||||
|
@ -10177,5 +10177,13 @@
|
||||
"kind": "flag",
|
||||
"bug_numbers": [1229971],
|
||||
"description": "Flag activated whenever a rewritable youtube flash embed is seen during a session."
|
||||
},
|
||||
"PLUGIN_DRAWING_MODEL": {
|
||||
"alert_emails": ["danderson@mozilla.com"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"bug_numbers": [1229961],
|
||||
"n_values": 12,
|
||||
"description": "Plugin drawing model. 0 when windowed, otherwise NPDrawingModel + 1."
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user