Backed out 2 changesets (bug 1154231) for M-oth crashes

CLOSED TREE

Backed out changeset 5e8145eff457 (bug 1154231)
Backed out changeset 951fb8ed6f25 (bug 1154231)
This commit is contained in:
Phil Ringnalda 2015-05-15 20:29:15 -07:00
Родитель a369149681
Коммит a5df436c2e
15 изменённых файлов: 10 добавлений и 320 удалений

Просмотреть файл

@ -1140,6 +1140,3 @@ pref("dom.activities.developer_mode_only", "import-app");
// mulet apparently loads firefox.js as well as b2g.js, so we have to explicitly
// disable serviceworkers here to get them disabled in mulet.
pref("dom.serviceWorkers.enabled", false);
// Retain at most 10 processes' layers buffers
pref("layers.compositor-lru-size", 10);

Просмотреть файл

@ -2985,23 +2985,17 @@ TabChild::NotifyPainted()
void
TabChild::MakeVisible()
{
CompositorChild* compositor = CompositorChild::Get();
compositor->SendNotifyVisible(mLayersId);
if (mWidget) {
mWidget->Show(true);
}
if (mWidget) {
mWidget->Show(true);
}
}
void
TabChild::MakeHidden()
{
CompositorChild* compositor = CompositorChild::Get();
compositor->SendNotifyHidden(mLayersId);
if (mWidget) {
mWidget->Show(false);
}
if (mWidget) {
mWidget->Show(false);
}
}
void
@ -3143,17 +3137,6 @@ TabChild::DidComposite(uint64_t aTransactionId)
manager->DidComposite(aTransactionId);
}
void
TabChild::ClearCachedResources()
{
MOZ_ASSERT(mWidget);
MOZ_ASSERT(mWidget->GetLayerManager());
MOZ_ASSERT(mWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT);
ClientLayerManager *manager = static_cast<ClientLayerManager*>(mWidget->GetLayerManager());
manager->ClearCachedResources();
}
NS_IMETHODIMP
TabChild::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText)
{

Просмотреть файл

@ -474,7 +474,6 @@ public:
static TabChild* GetFrom(uint64_t aLayersId);
void DidComposite(uint64_t aTransactionId);
void ClearCachedResources();
static inline TabChild*
GetFrom(nsIDOMWindow* aWindow)

Просмотреть файл

@ -372,16 +372,6 @@ CompositorChild::AddOverfillObserver(ClientLayerManager* aLayerManager)
mOverfillObservers.AppendElement(aLayerManager);
}
bool
CompositorChild::RecvClearCachedResources(const uint64_t& aId)
{
dom::TabChild* child = dom::TabChild::GetFrom(aId);
if (child) {
child->ClearCachedResources();
}
return true;
}
void
CompositorChild::ActorDestroy(ActorDestroyReason aWhy)
{
@ -559,26 +549,6 @@ CompositorChild::SendResume()
return PCompositorChild::SendResume();
}
bool
CompositorChild::SendNotifyHidden(const uint64_t& id)
{
MOZ_ASSERT(mCanSend);
if (!mCanSend) {
return true;
}
return PCompositorChild::SendNotifyHidden(id);
}
bool
CompositorChild::SendNotifyVisible(const uint64_t& id)
{
MOZ_ASSERT(mCanSend);
if (!mCanSend) {
return true;
}
return PCompositorChild::SendNotifyVisible(id);
}
bool
CompositorChild::SendNotifyChildCreated(const uint64_t& id)
{

Просмотреть файл

@ -70,9 +70,6 @@ public:
void AddOverfillObserver(ClientLayerManager* aLayerManager);
virtual bool
RecvClearCachedResources(const uint64_t& id) override;
virtual bool
RecvDidComposite(const uint64_t& aId, const uint64_t& aTransactionId) override;
@ -109,8 +106,6 @@ public:
bool SendWillStop();
bool SendPause();
bool SendResume();
bool SendNotifyHidden(const uint64_t& id);
bool SendNotifyVisible(const uint64_t& id);
bool SendNotifyChildCreated(const uint64_t& id);
bool SendAdoptChild(const uint64_t& id);
bool SendMakeSnapshot(const SurfaceDescriptor& inSnapshot, const gfx::IntRect& dirtyRect);

Просмотреть файл

@ -1,101 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CompositorLRU.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Preferences.h"
#include "mozilla/unused.h"
#include "CompositorParent.h"
namespace mozilla {
namespace layers {
mozilla::StaticRefPtr<CompositorLRU> CompositorLRU::sSingleton;
void
CompositorLRU::Init()
{
unused << GetSingleton();
}
CompositorLRU*
CompositorLRU::GetSingleton()
{
if (sSingleton) {
return sSingleton;
}
sSingleton = new CompositorLRU();
ClearOnShutdown(&sSingleton);
return sSingleton;
}
CompositorLRU::CompositorLRU()
{
mLRUSize = Preferences::GetUint("layers.compositor-lru-size", uint32_t(0));
}
CompositorLRU::~CompositorLRU()
{
}
void
CompositorLRU::Add(PCompositorParent* aCompositor, const uint64_t& aId)
{
auto index = mLRU.IndexOf(std::make_pair(aCompositor, aId));
if (index != nsTArray<CompositorLayerPair>::NoIndex) {
return;
}
if (mLRUSize == 0) {
unused << aCompositor->SendClearCachedResources(aId);
return;
}
if (mLRU.Length() == mLRUSize) {
CompositorLayerPair victim = mLRU.LastElement();
unused << victim.first->SendClearCachedResources(victim.second);
mLRU.RemoveElement(victim);
}
mLRU.InsertElementAt(0, std::make_pair(aCompositor, aId));
}
void
CompositorLRU::Remove(PCompositorParent* aCompositor, const uint64_t& aId)
{
if (mLRUSize == 0) {
return;
}
auto index = mLRU.IndexOf(std::make_pair(aCompositor, aId));
if (index == nsTArray<PCompositorParent*>::NoIndex) {
return;
}
mLRU.RemoveElementAt(index);
}
void
CompositorLRU::Remove(PCompositorParent* aCompositor)
{
if (mLRUSize == 0) {
return;
}
for (int32_t i = mLRU.Length() - 1; i >= 0; --i) {
if (mLRU[i].first == aCompositor) {
mLRU.RemoveElementAt(i);
}
}
}
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_CompositorLRU_h
#define mozilla_CompositorLRU_h
#include "mozilla/StaticPtr.h"
#include "nsISupportsImpl.h"
#include "nsTArray.h"
#include <utility>
namespace mozilla {
namespace layers {
class PCompositorParent;
class CompositorLRU final
{
typedef std::pair<PCompositorParent*, uint64_t> CompositorLayerPair;
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorLRU)
static void Init();
static CompositorLRU* GetSingleton();
/**
* Adds the (PCompositorParent, LayerId) pair to the LRU pool. If
* the pool size grows over mLRUSize, the oldest PCompositorParent
* is evicted.
*/
void Add(PCompositorParent* aCompositor, const uint64_t& id);
/**
* Remove the (PCompositorParent, LayersId) pair from the LRU pool.
*/
void Remove(PCompositorParent* aCompositor, const uint64_t& id);
/**
* Remove all PCompositorParents from the LRU pool.
*/
void Remove(PCompositorParent* aCompositor);
private:
static StaticRefPtr<CompositorLRU> sSingleton;
CompositorLRU();
~CompositorLRU();
uint32_t mLRUSize;
nsTArray<CompositorLayerPair> mLRU;
};
} // namespace layers
} // namespace mozilla
#endif // mozilla_CompositorLRU_h

Просмотреть файл

@ -34,7 +34,6 @@
#include "mozilla/layers/AsyncCompositionManager.h"
#include "mozilla/layers/BasicCompositor.h" // for BasicCompositor
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorLRU.h" // for CompositorLRU
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayerManagerComposite.h"
@ -1687,8 +1686,6 @@ public:
virtual bool RecvStop() override { return true; }
virtual bool RecvPause() override { return true; }
virtual bool RecvResume() override { return true; }
virtual bool RecvNotifyHidden(const uint64_t& id) override;
virtual bool RecvNotifyVisible(const uint64_t& id) override;
virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
virtual bool RecvAdoptChild(const uint64_t& child) override { return false; }
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
@ -1844,22 +1841,6 @@ CompositorParent::GetIndirectShadowTree(uint64_t aId)
return &cit->second;
}
bool
CrossProcessCompositorParent::RecvNotifyHidden(const uint64_t& id)
{
nsRefPtr<CompositorLRU> lru = CompositorLRU::GetSingleton();
lru->Add(this, id);
return true;
}
bool
CrossProcessCompositorParent::RecvNotifyVisible(const uint64_t& id)
{
nsRefPtr<CompositorLRU> lru = CompositorLRU::GetSingleton();
lru->Remove(this, id);
return true;
}
bool
CrossProcessCompositorParent::RecvRequestNotifyAfterRemotePaint()
{
@ -1870,9 +1851,6 @@ CrossProcessCompositorParent::RecvRequestNotifyAfterRemotePaint()
void
CrossProcessCompositorParent::ActorDestroy(ActorDestroyReason aWhy)
{
nsRefPtr<CompositorLRU> lru = CompositorLRU::GetSingleton();
lru->Remove(this);
MessageLoop::current()->PostTask(
FROM_HERE,
NewRunnableMethod(this, &CrossProcessCompositorParent::DeferredDestroy));

Просмотреть файл

@ -234,8 +234,6 @@ public:
virtual bool RecvStop() override;
virtual bool RecvPause() override;
virtual bool RecvResume() override;
virtual bool RecvNotifyHidden(const uint64_t& id) override { return true; }
virtual bool RecvNotifyVisible(const uint64_t& id) override { return true; }
virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
virtual bool RecvAdoptChild(const uint64_t& child) override;
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,

Просмотреть файл

@ -70,12 +70,6 @@ child:
*/
async UpdatePluginVisibility(uintptr_t[] aVisibleIdList);
/**
* Drop any buffers that might be retained on the child compositor
* side.
*/
async ClearCachedResources(uint64_t id);
parent:
// Child sends the parent a request for fill ratio numbers.
async RequestOverfill();
@ -91,14 +85,6 @@ parent:
sync Pause();
sync Resume();
// The child layer tree is hidden. id is the layers id of the child
// layer tree.
async NotifyHidden(uint64_t id);
// The child layer tree is visible. id is the layers id of the child
// layer tree.
async NotifyVisible(uint64_t id);
async NotifyChildCreated(uint64_t id);
async AdoptChild(uint64_t id);

Просмотреть файл

@ -139,7 +139,6 @@ EXPORTS.mozilla.layers += [
'ipc/CompositableForwarder.h',
'ipc/CompositableTransactionParent.h',
'ipc/CompositorChild.h',
'ipc/CompositorLRU.h',
'ipc/CompositorParent.h',
'ipc/FenceUtils.h',
'ipc/ImageBridgeChild.h',
@ -295,7 +294,6 @@ UNIFIED_SOURCES += [
'ipc/CompositableTransactionParent.cpp',
'ipc/CompositorBench.cpp',
'ipc/CompositorChild.cpp',
'ipc/CompositorLRU.cpp',
'ipc/CompositorParent.cpp',
'ipc/ImageBridgeChild.cpp',
'ipc/ImageBridgeParent.cpp',

Просмотреть файл

@ -139,7 +139,6 @@ using namespace mozilla::system;
#include "CameraPreferences.h"
#include "TouchManager.h"
#include "MediaDecoder.h"
#include "mozilla/layers/CompositorLRU.h"
using namespace mozilla;
using namespace mozilla::net;
@ -321,8 +320,6 @@ nsLayoutStatics::Initialize()
PromiseDebugging::Init();
layers::CompositorLRU::Init();
return NS_OK;
}

Просмотреть файл

@ -4148,9 +4148,6 @@ pref("layers.force-active", false);
// platform and are the optimal surface type.
pref("layers.gralloc.disable", false);
// Don't use compositor-lru on this platform
pref("layers.compositor-lru-size", 0);
// Enable/Disable the geolocation API for content
pref("geo.enabled", true);

Просмотреть файл

@ -118,11 +118,6 @@ PuppetWidget::Create(nsIWidget *aParent,
else {
Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, false);
}
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
mMemoryPressureObserver = new MemoryPressureObserver(this);
obs->AddObserver(mMemoryPressureObserver, "memory-pressure", false);
}
return NS_OK;
}
@ -158,9 +153,6 @@ PuppetWidget::Destroy()
Base::OnDestroy();
Base::Destroy();
mPaintTask.Revoke();
if (mMemoryPressureObserver) {
mMemoryPressureObserver->Remove();
}
mChild = nullptr;
if (mLayerManager) {
mLayerManager->Destroy();
@ -183,6 +175,10 @@ PuppetWidget::Show(bool aState)
mChild->mVisible = aState;
}
if (!mVisible && mLayerManager) {
mLayerManager->ClearCachedResources();
}
if (!wasVisible && mVisible) {
Resize(mBounds.width, mBounds.height, false);
Invalidate(mBounds);
@ -1034,35 +1030,6 @@ PuppetWidget::PaintTask::Run()
return NS_OK;
}
NS_IMPL_ISUPPORTS(PuppetWidget::MemoryPressureObserver, nsIObserver)
NS_IMETHODIMP
PuppetWidget::MemoryPressureObserver::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
if (!mWidget) {
return NS_OK;
}
if (strcmp("memory-pressure", aTopic) == 0) {
if (!mWidget->mVisible && mWidget->mLayerManager) {
mWidget->mLayerManager->ClearCachedResources();
}
}
return NS_OK;
}
void
PuppetWidget::MemoryPressureObserver::Remove()
{
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->RemoveObserver(this, "memory-pressure");
}
mWidget = nullptr;
}
bool
PuppetWidget::NeedsPaint()
{

Просмотреть файл

@ -280,18 +280,6 @@ private:
PuppetWidget* mWidget;
};
class MemoryPressureObserver : public nsIObserver {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
explicit MemoryPressureObserver(PuppetWidget* aWidget) : mWidget(aWidget) {}
void Remove();
private:
virtual ~MemoryPressureObserver() {}
PuppetWidget* mWidget;
};
friend class MemoryPressureObserver;
// TabChild normally holds a strong reference to this PuppetWidget
// or its root ancestor, but each PuppetWidget also needs a
// reference back to TabChild (e.g. to delegate nsIWidget IME calls
@ -304,7 +292,6 @@ private:
nsRefPtr<PuppetWidget> mChild;
nsIntRegion mDirtyRegion;
nsRevocableEventPtr<PaintTask> mPaintTask;
nsRefPtr<MemoryPressureObserver> mMemoryPressureObserver;
// XXX/cjones: keeping this around until we teach LayerManager to do
// retained-content-only transactions
mozilla::RefPtr<DrawTarget> mDrawTarget;