зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1062411 - Make FrameMetrics::mContentDescription an nsCString so there is no limit to its length. r=BenWa
This commit is contained in:
Родитель
af78326e62
Коммит
dea86069ca
|
@ -60,10 +60,6 @@ namespace layers {
|
|||
* time of a layer-tree transaction. These metrics are especially
|
||||
* useful for shadow layers, because the metrics values are updated
|
||||
* atomically with new pixels.
|
||||
*
|
||||
* Note that the FrameMetrics struct is sometimes stored in shared
|
||||
* memory and shared across processes, so it should be a "Plain Old
|
||||
* Data (POD)" type with no members that use dynamic memory.
|
||||
*/
|
||||
struct FrameMetrics {
|
||||
friend struct IPC::ParamTraits<mozilla::layers::FrameMetrics>;
|
||||
|
@ -101,7 +97,6 @@ public:
|
|||
, mViewport(0, 0, 0, 0)
|
||||
, mBackgroundColor(0, 0, 0, 0)
|
||||
{
|
||||
mContentDescription[0] = '\0';
|
||||
}
|
||||
|
||||
// Default copy ctor and operator= are fine
|
||||
|
@ -128,8 +123,7 @@ public:
|
|||
mScrollOffset == aOther.mScrollOffset &&
|
||||
mHasScrollgrab == aOther.mHasScrollgrab &&
|
||||
mUpdateScrollOffset == aOther.mUpdateScrollOffset &&
|
||||
mBackgroundColor == aOther.mBackgroundColor &&
|
||||
!strcmp(mContentDescription, aOther.mContentDescription);
|
||||
mBackgroundColor == aOther.mBackgroundColor;
|
||||
}
|
||||
bool operator!=(const FrameMetrics& aOther) const
|
||||
{
|
||||
|
@ -247,6 +241,16 @@ public:
|
|||
mScrollGeneration = aOther.mScrollGeneration;
|
||||
}
|
||||
|
||||
// Make a copy of this FrameMetrics object which does not have any pointers
|
||||
// to heap-allocated memory (i.e. is Plain Old Data, or 'POD'), and is
|
||||
// therefore safe to be placed into shared memory.
|
||||
FrameMetrics MakePODObject() const
|
||||
{
|
||||
FrameMetrics copy = *this;
|
||||
copy.mContentDescription.Truncate();
|
||||
return copy;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// The following metrics are all in widget space/device pixels.
|
||||
//
|
||||
|
@ -484,16 +488,14 @@ public:
|
|||
mBackgroundColor = aBackgroundColor;
|
||||
}
|
||||
|
||||
nsCString GetContentDescription() const
|
||||
const nsCString& GetContentDescription() const
|
||||
{
|
||||
return nsCString(mContentDescription);
|
||||
return mContentDescription;
|
||||
}
|
||||
|
||||
void SetContentDescription(const nsCString& aContentDescription)
|
||||
{
|
||||
strncpy(mContentDescription, aContentDescription.get(),
|
||||
sizeof(mContentDescription));
|
||||
mContentDescription[sizeof(mContentDescription) - 1] = 0;
|
||||
mContentDescription = aContentDescription;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -569,9 +571,9 @@ private:
|
|||
gfxRGBA mBackgroundColor;
|
||||
|
||||
// A description of the content element corresponding to this frame.
|
||||
// This is empty unless this is a scrollable ContainerLayer and the
|
||||
// This is empty unless this is a scrollable layer and the
|
||||
// apz.printtree pref is turned on.
|
||||
char mContentDescription[20];
|
||||
nsCString mContentDescription;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -2868,7 +2868,7 @@ void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics()
|
|||
|
||||
if (frame && mSharedLock && gfxPrefs::UseProgressiveTilePainting()) {
|
||||
mSharedLock->Lock();
|
||||
*frame = mFrameMetrics;
|
||||
*frame = mFrameMetrics.MakePODObject();
|
||||
mSharedLock->Unlock();
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче