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

Side by Side Diff: third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 MHTMLArchive::MHTMLArchive() 65 MHTMLArchive::MHTMLArchive()
66 { 66 {
67 } 67 }
68 68
69 MHTMLArchive::~MHTMLArchive() 69 MHTMLArchive::~MHTMLArchive()
70 { 70 {
71 } 71 }
72 72
73 PassRefPtrWillBeRawPtr<MHTMLArchive> MHTMLArchive::create(const KURL& url, Share dBuffer* data) 73 RawPtr<MHTMLArchive> MHTMLArchive::create(const KURL& url, SharedBuffer* data)
74 { 74 {
75 // For security reasons we only load MHTML pages from local URLs. 75 // For security reasons we only load MHTML pages from local URLs.
76 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol())) 76 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()))
77 return nullptr; 77 return nullptr;
78 78
79 MHTMLParser parser(data); 79 MHTMLParser parser(data);
80 WillBeHeapVector<RefPtrWillBeMember<ArchiveResource>> resources = parser.par seArchive(); 80 HeapVector<Member<ArchiveResource>> resources = parser.parseArchive();
81 if (resources.isEmpty()) 81 if (resources.isEmpty())
82 return nullptr; // Invalid MHTML file. 82 return nullptr; // Invalid MHTML file.
83 83
84 RefPtrWillBeRawPtr<MHTMLArchive> archive = adoptRefWillBeNoop(new MHTMLArchi ve); 84 RawPtr<MHTMLArchive> archive = (new MHTMLArchive);
85 // The first document suitable resource is the main resource of the top fram e. 85 // The first document suitable resource is the main resource of the top fram e.
86 for (size_t i = 0; i < resources.size(); ++i) { 86 for (size_t i = 0; i < resources.size(); ++i) {
87 const AtomicString& mimeType = resources[i]->mimeType(); 87 const AtomicString& mimeType = resources[i]->mimeType();
88 if (archive->mainResource() || !MIMETypeRegistry::isSupportedNonImageMIM EType(mimeType) || MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || mimeType == "text/css") 88 if (archive->mainResource() || !MIMETypeRegistry::isSupportedNonImageMIM EType(mimeType) || MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || mimeType == "text/css")
89 archive->addSubresource(resources[i].get()); 89 archive->addSubresource(resources[i].get());
90 else 90 else
91 archive->setMainResource(resources[i].get()); 91 archive->setMainResource(resources[i].get());
92 } 92 }
93 return archive.release(); 93 return archive.release();
94 } 94 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 void MHTMLArchive::generateMHTMLFooter( 213 void MHTMLArchive::generateMHTMLFooter(
214 const String& boundary, 214 const String& boundary,
215 SharedBuffer& outputBuffer) 215 SharedBuffer& outputBuffer)
216 { 216 {
217 ASSERT(!boundary.isEmpty()); 217 ASSERT(!boundary.isEmpty());
218 CString asciiString = String("--" + boundary + "--\r\n").utf8(); 218 CString asciiString = String("--" + boundary + "--\r\n").utf8();
219 outputBuffer.append(asciiString.data(), asciiString.length()); 219 outputBuffer.append(asciiString.data(), asciiString.length());
220 } 220 }
221 221
222 void MHTMLArchive::setMainResource(PassRefPtrWillBeRawPtr<ArchiveResource> mainR esource) 222 void MHTMLArchive::setMainResource(RawPtr<ArchiveResource> mainResource)
223 { 223 {
224 m_mainResource = mainResource; 224 m_mainResource = mainResource;
225 } 225 }
226 226
227 void MHTMLArchive::addSubresource(ArchiveResource* resource) 227 void MHTMLArchive::addSubresource(ArchiveResource* resource)
228 { 228 {
229 const KURL& url = resource->url(); 229 const KURL& url = resource->url();
230 m_subresources.set(url, resource); 230 m_subresources.set(url, resource);
231 KURL cidURI = MHTMLParser::convertContentIDToURI(resource->contentID()); 231 KURL cidURI = MHTMLParser::convertContentIDToURI(resource->contentID());
232 if (cidURI.isValid()) 232 if (cidURI.isValid())
233 m_subresources.set(cidURI, resource); 233 m_subresources.set(cidURI, resource);
234 } 234 }
235 235
236 ArchiveResource* MHTMLArchive::subresourceForURL(const KURL& url) const 236 ArchiveResource* MHTMLArchive::subresourceForURL(const KURL& url) const
237 { 237 {
238 return m_subresources.get(url.string()); 238 return m_subresources.get(url.string());
239 } 239 }
240 240
241 DEFINE_TRACE(MHTMLArchive) 241 DEFINE_TRACE(MHTMLArchive)
242 { 242 {
243 visitor->trace(m_mainResource); 243 visitor->trace(m_mainResource);
244 #if ENABLE(OILPAN) 244 #if ENABLE(OILPAN)
245 visitor->trace(m_subresources); 245 visitor->trace(m_subresources);
246 #endif 246 #endif
247 } 247 }
248 248
249 } // namespace blink 249 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698