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

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

Issue 2379823003: Move MHTML file writing out of the renderer main thread. (Closed)
Patch Set: Address reviewer comments. Created 4 years, 2 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 enum EncodingPolicy { UseDefaultEncoding, UseBinaryEncoding }; 54 enum EncodingPolicy { UseDefaultEncoding, UseBinaryEncoding };
55 55
56 // Generates an MHTML header and appends it to |outputBuffer|. 56 // Generates an MHTML header and appends it to |outputBuffer|.
57 // 57 //
58 // Same |boundary| needs to used for all generateMHTMLHeader and 58 // Same |boundary| needs to used for all generateMHTMLHeader and
59 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same 59 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same
60 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 60 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
61 static void generateMHTMLHeader(const String& boundary, 61 static void generateMHTMLHeader(const String& boundary,
62 const String& title, 62 const String& title,
63 const String& mimeType, 63 const String& mimeType,
64 SharedBuffer& outputBuffer); 64 Vector<char>& outputBuffer);
65 65
66 // Serializes SerializedResource as an MHTML part and appends it in 66 // Serializes SerializedResource as an MHTML part and appends it in
67 // |outputBuffer|. 67 // |outputBuffer|.
68 // 68 //
69 // Same |boundary| needs to used for all generateMHTMLHeader and 69 // Same |boundary| needs to used for all generateMHTMLHeader and
70 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same 70 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same
71 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 71 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
72 // 72 //
73 // If |contentID| is non-empty, then it will be used as a Content-ID header. 73 // If |contentID| is non-empty, then it will be used as a Content-ID header.
74 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs". 74 // See rfc2557 - section 8.3 - "Use of the Content-ID header and CID URLs".
75 static void generateMHTMLPart(const String& boundary, 75 static void generateMHTMLPart(const String& boundary,
76 const String& contentID, 76 const String& contentID,
77 EncodingPolicy, 77 EncodingPolicy,
78 const SerializedResource&, 78 const SerializedResource&,
79 SharedBuffer& outputBuffer); 79 Vector<char>& outputBuffer);
80 80
81 // Generates an MHTML footer and appends it to |outputBuffer|. 81 // Generates an MHTML footer and appends it to |outputBuffer|.
82 // 82 //
83 // Same |boundary| needs to used for all generateMHTMLHeader and 83 // Same |boundary| needs to used for all generateMHTMLHeader and
84 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same 84 // generateMHTMLPart and generateMHTMLFooter calls that belong to the same
85 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description). 85 // MHTML document (see also rfc1341, section 7.2.1, "boundary" description).
86 static void generateMHTMLFooter(const String& boundary, 86 static void generateMHTMLFooter(const String& boundary,
87 SharedBuffer& outputBuffer); 87 Vector<char>& outputBuffer);
88 88
89 typedef HeapHashMap<String, Member<ArchiveResource>> SubArchiveResources; 89 typedef HeapHashMap<String, Member<ArchiveResource>> SubArchiveResources;
90 90
91 ArchiveResource* mainResource() { return m_mainResource.get(); } 91 ArchiveResource* mainResource() { return m_mainResource.get(); }
92 ArchiveResource* subresourceForURL(const KURL&) const; 92 ArchiveResource* subresourceForURL(const KURL&) const;
93 93
94 DECLARE_TRACE(); 94 DECLARE_TRACE();
95 95
96 private: 96 private:
97 MHTMLArchive(); 97 MHTMLArchive();
98 98
99 void setMainResource(ArchiveResource*); 99 void setMainResource(ArchiveResource*);
100 void addSubresource(ArchiveResource*); 100 void addSubresource(ArchiveResource*);
101 static bool canLoadArchive(const KURL&); 101 static bool canLoadArchive(const KURL&);
102 102
103 Member<ArchiveResource> m_mainResource; 103 Member<ArchiveResource> m_mainResource;
104 SubArchiveResources m_subresources; 104 SubArchiveResources m_subresources;
105 }; 105 };
106 106
107 } // namespace blink 107 } // namespace blink
108 108
109 #endif 109 #endif
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698