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

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: Put MHTMLParser on the stack 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..8cc1f9cbe70f230ab06584d56028e4c833172a4a 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));
@@ -216,13 +219,13 @@ PassRefPtr<SharedBuffer> MHTMLArchive::generateMHTMLData(const Vector<Serialized
void MHTMLArchive::clearAllSubframeArchives()
haraken 2014/07/08 08:50:08 I'm curious why we need to call clearAllSubframeAr
haraken 2014/07/08 08:50:08 Can we add #if !ENABLE(OILPAN) to this method?
sof 2014/07/08 09:10:00 I think you're right, I didn't see the point of th
{
- Vector<RefPtr<MHTMLArchive> > clearedArchives;
+ SubFrameArchives clearedArchives;
clearAllSubframeArchivesImpl(&clearedArchives);
}
-void MHTMLArchive::clearAllSubframeArchivesImpl(Vector<RefPtr<MHTMLArchive> >* clearedArchives)
+void MHTMLArchive::clearAllSubframeArchivesImpl(SubFrameArchives* clearedArchives)
haraken 2014/07/08 08:50:07 Ditto.
{
- 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);
@@ -231,4 +234,11 @@ void MHTMLArchive::clearAllSubframeArchivesImpl(Vector<RefPtr<MHTMLArchive> >* c
m_subframeArchives.clear();
}
+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