Remove the MemoryReportRequestChild dependency on ContentChild. (bug 1321492 part 2, r=erahm)

This commit is contained in:
David Anderson 2017-01-26 16:35:53 -08:00
Родитель 356cc23a9a
Коммит b953cadaaa
3 изменённых файлов: 13 добавлений и 12 удалений

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

@ -1023,8 +1023,12 @@ ContentChild::AllocPMemoryReportRequestChild(const uint32_t& aGeneration,
const bool &aMinimizeMemoryUsage,
const MaybeFileDesc& aDMDFile)
{
nsCString process;
GetProcessName(process);
AppendProcessId(process);
auto *actor =
new MemoryReportRequestChild(aAnonymize, aDMDFile);
new MemoryReportRequestChild(aAnonymize, aDMDFile, process);
actor->AddRef();
return actor;
}

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

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MemoryReportRequest.h"
#include "mozilla/dom/ContentChild.h"
namespace mozilla {
namespace dom {
@ -55,8 +54,10 @@ MemoryReportRequestParent::~MemoryReportRequestParent()
NS_IMPL_ISUPPORTS(MemoryReportRequestChild, nsIRunnable)
MemoryReportRequestChild::MemoryReportRequestChild(
bool aAnonymize, const MaybeFileDesc& aDMDFile)
: mAnonymize(aAnonymize)
bool aAnonymize, const MaybeFileDesc& aDMDFile,
const nsACString& aProcessString)
: mAnonymize(aAnonymize),
mProcessString(aProcessString)
{
if (aDMDFile.type() == MaybeFileDesc::TFileDescriptor) {
mDMDFile = aDMDFile.get_FileDescriptor();
@ -127,21 +128,15 @@ NS_IMPL_ISUPPORTS(
, nsIFinishReportingCallback
)
NS_IMETHODIMP MemoryReportRequestChild::Run()
{
ContentChild *child = static_cast<ContentChild*>(Manager());
nsCOMPtr<nsIMemoryReporterManager> mgr =
do_GetService("@mozilla.org/memory-reporter-manager;1");
nsCString process;
child->GetProcessName(process);
child->AppendProcessId(process);
// Run the reporters. The callback will turn each measurement into a
// MemoryReport.
RefPtr<HandleReportCallback> handleReport =
new HandleReportCallback(this, process);
new HandleReportCallback(this, mProcessString);
RefPtr<FinishReportingCallback> finishReporting =
new FinishReportingCallback(this);

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

@ -41,7 +41,8 @@ public:
NS_DECL_ISUPPORTS
MemoryReportRequestChild(bool aAnonymize,
const MaybeFileDesc& aDMDFile);
const MaybeFileDesc& aDMDFile,
const nsACString& aProcessString);
NS_IMETHOD Run() override;
private:
@ -49,6 +50,7 @@ private:
bool mAnonymize;
FileDescriptor mDMDFile;
nsCString mProcessString;
};
} // namespace dom