Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: Source/platform/mhtml/MHTMLArchive.cpp

Issue 374053002: Oilpan: move MHTML objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make MHTMLArchive.h self-contained/closed. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/mhtml/MHTMLArchive.h ('k') | Source/platform/mhtml/MHTMLParser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/mhtml/MHTMLArchive.cpp
diff --git a/Source/platform/mhtml/MHTMLArchive.cpp b/Source/platform/mhtml/MHTMLArchive.cpp
index fe1ecc39b2080e043e174b9b53cb1c837f2daf7d..5544951ab5d3a63476822a6506e99f9cdbe72b4a 100644
--- a/Source/platform/mhtml/MHTMLArchive.cpp
+++ b/Source/platform/mhtml/MHTMLArchive.cpp
@@ -35,6 +35,7 @@
#include "platform/MIMETypeRegistry.h"
#include "platform/SerializedResource.h"
#include "platform/SharedBuffer.h"
+#include "platform/mhtml/ArchiveResource.h"
#include "platform/mhtml/MHTMLParser.h"
#include "platform/text/QuotedPrintable.h"
#include "platform/weborigin/SchemeRegistry.h"
@@ -86,29 +87,31 @@ MHTMLArchive::MHTMLArchive()
MHTMLArchive::~MHTMLArchive()
{
+#if !ENABLE(OILPAN)
// Because all frames know about each other we need to perform a deep clearing of the archives graph.
clearAllSubframeArchives();
+#endif
}
-PassRefPtr<MHTMLArchive> MHTMLArchive::create()
+PassRefPtrWillBeRawPtr<MHTMLArchive> MHTMLArchive::create()
{
- return adoptRef(new MHTMLArchive);
+ return adoptRefWillBeNoop(new MHTMLArchive);
}
-PassRefPtr<MHTMLArchive> MHTMLArchive::create(const KURL& url, SharedBuffer* data)
+PassRefPtrWillBeRawPtr<MHTMLArchive> MHTMLArchive::create(const KURL& url, SharedBuffer* data)
{
// For security reasons we only load MHTML pages from local URLs.
if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()))
return nullptr;
MHTMLParser parser(data);
- RefPtr<MHTMLArchive> mainArchive = parser.parseArchive();
+ RefPtrWillBeRawPtr<MHTMLArchive> mainArchive = parser.parseArchive();
if (!mainArchive)
return nullptr; // Invalid MHTML file.
// Since MHTML is a flat format, we need to make all frames aware of all resources.
for (size_t i = 0; i < parser.frameCount(); ++i) {
- RefPtr<MHTMLArchive> archive = parser.frameAt(i);
+ RefPtrWillBeRawPtr<MHTMLArchive> archive = parser.frameAt(i);
for (size_t j = 1; j < parser.frameCount(); ++j) {
if (i != j)
archive->addSubframeArchive(parser.frameAt(j));
@@ -214,15 +217,16 @@ PassRefPtr<SharedBuffer> MHTMLArchive::generateMHTMLData(const Vector<Serialized
return mhtmlData.release();
}
+#if !ENABLE(OILPAN)
void MHTMLArchive::clearAllSubframeArchives()
{
- Vector<RefPtr<MHTMLArchive> > clearedArchives;
+ SubFrameArchives clearedArchives;
clearAllSubframeArchivesImpl(&clearedArchives);
}
-void MHTMLArchive::clearAllSubframeArchivesImpl(Vector<RefPtr<MHTMLArchive> >* clearedArchives)
+void MHTMLArchive::clearAllSubframeArchivesImpl(SubFrameArchives* clearedArchives)
{
- for (Vector<RefPtr<MHTMLArchive> >::iterator it = m_subframeArchives.begin(); it != m_subframeArchives.end(); ++it) {
+ for (SubFrameArchives::iterator it = m_subframeArchives.begin(); it != m_subframeArchives.end(); ++it) {
if (!clearedArchives->contains(*it)) {
clearedArchives->append(*it);
(*it)->clearAllSubframeArchivesImpl(clearedArchives);
@@ -230,5 +234,28 @@ void MHTMLArchive::clearAllSubframeArchivesImpl(Vector<RefPtr<MHTMLArchive> >* c
}
m_subframeArchives.clear();
}
+#endif
+
+void MHTMLArchive::setMainResource(PassRefPtrWillBeRawPtr<ArchiveResource> mainResource)
+{
+ m_mainResource = mainResource;
+}
+
+void MHTMLArchive::addSubresource(PassRefPtrWillBeRawPtr<ArchiveResource> subResource)
+{
+ m_subresources.append(subResource);
+}
+
+void MHTMLArchive::addSubframeArchive(PassRefPtrWillBeRawPtr<MHTMLArchive> subframeArchive)
+{
+ m_subframeArchives.append(subframeArchive);
+}
+
+void MHTMLArchive::trace(Visitor* visitor)
+{
+ visitor->trace(m_mainResource);
+ visitor->trace(m_subresources);
+ visitor->trace(m_subframeArchives);
+}
}
« no previous file with comments | « Source/platform/mhtml/MHTMLArchive.h ('k') | Source/platform/mhtml/MHTMLParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698