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

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

Issue 2731293004: Move the writing of the MHTML footer to the browser process. (Closed)
Patch Set: Comments and naming changes. Created 3 years, 9 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 size_t lineLength = 239 size_t lineLength =
240 std::min(encodedDataLength - index, maximumLineLength); 240 std::min(encodedDataLength - index, maximumLineLength);
241 outputBuffer.append(encodedData.data() + index, lineLength); 241 outputBuffer.append(encodedData.data() + index, lineLength);
242 outputBuffer.append("\r\n", 2u); 242 outputBuffer.append("\r\n", 2u);
243 index += maximumLineLength; 243 index += maximumLineLength;
244 } while (index < encodedDataLength); 244 } while (index < encodedDataLength);
245 } 245 }
246 } 246 }
247 } 247 }
248 248
249 void MHTMLArchive::generateMHTMLFooter(const String& boundary, 249 void MHTMLArchive::generateMHTMLFooterForTesting(const String& boundary,
250 Vector<char>& outputBuffer) { 250 Vector<char>& outputBuffer) {
251 ASSERT(!boundary.isEmpty()); 251 ASSERT(!boundary.isEmpty());
252 CString asciiString = String("--" + boundary + "--\r\n").utf8(); 252 CString asciiString = String("--" + boundary + "--\r\n").utf8();
253 outputBuffer.append(asciiString.data(), asciiString.length()); 253 outputBuffer.append(asciiString.data(), asciiString.length());
254 } 254 }
255 255
256 void MHTMLArchive::setMainResource(ArchiveResource* mainResource) { 256 void MHTMLArchive::setMainResource(ArchiveResource* mainResource) {
257 m_mainResource = mainResource; 257 m_mainResource = mainResource;
258 } 258 }
259 259
260 void MHTMLArchive::addSubresource(ArchiveResource* resource) { 260 void MHTMLArchive::addSubresource(ArchiveResource* resource) {
261 const KURL& url = resource->url(); 261 const KURL& url = resource->url();
262 m_subresources.set(url, resource); 262 m_subresources.set(url, resource);
263 KURL cidURI = MHTMLParser::convertContentIDToURI(resource->contentID()); 263 KURL cidURI = MHTMLParser::convertContentIDToURI(resource->contentID());
264 if (cidURI.isValid()) 264 if (cidURI.isValid())
265 m_subresources.set(cidURI, resource); 265 m_subresources.set(cidURI, resource);
266 } 266 }
267 267
268 ArchiveResource* MHTMLArchive::subresourceForURL(const KURL& url) const { 268 ArchiveResource* MHTMLArchive::subresourceForURL(const KURL& url) const {
269 return m_subresources.at(url.getString()); 269 return m_subresources.at(url.getString());
270 } 270 }
271 271
272 DEFINE_TRACE(MHTMLArchive) { 272 DEFINE_TRACE(MHTMLArchive) {
273 visitor->trace(m_mainResource); 273 visitor->trace(m_mainResource);
274 visitor->trace(m_subresources); 274 visitor->trace(m_subresources);
275 } 275 }
276 276
277 } // namespace blink 277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698