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

Unified Diff: content/common/frame_messages.h

Issue 1417323006: OOPIFs: Deduplicating MHTML parts across frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mhtml-serialization-per-frame
Patch Set: Rebasing... Created 5 years 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
Index: content/common/frame_messages.h
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index b70017e2e1e381f3084c4533394d31fa61beb3f5..a9c34e472d815af3d40c54fc33552c229dfca697 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -5,6 +5,11 @@
// IPC messages for interacting with frames.
// Multiply-included message file, hence no include guard.
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_sequence.h"
#include "content/common/content_export.h"
@@ -427,6 +432,44 @@ IPC_STRUCT_TRAITS_BEGIN(content::SavableSubframe)
IPC_STRUCT_TRAITS_MEMBER(routing_id)
IPC_STRUCT_TRAITS_END()
+using FrameRoutingIdToContentIdMap = std::map<int, std::string>;
+IPC_STRUCT_BEGIN(FrameMsg_SerializeAsMHTML_Params)
+ // Job id - used to match responses to requests.
+ IPC_STRUCT_MEMBER(int, job_id)
+
+ // Destination file handle.
+ IPC_STRUCT_MEMBER(IPC::PlatformFileForTransit, destination_file)
+
+ // MHTML boundary marker.
+ //
+ // When serializing the first, main frame of an MHTML document,
+ // |mhtml_boundary_marker| should be an empty string. Otherwise it needs to
+ // be
+ // the marker generated and reported back by the previous
+ // FrameHostMsg_SerializeAsMHTMLResponse.
+ IPC_STRUCT_MEMBER(std::string, mhtml_boundary_marker)
+
+ // Frame to content-id map.
+ // Keys are routing ids of either RenderFrames or RenderFrameProxies.
+ // Values are MHTML content-ids - see WebPageSerializer::generateMHTMLParts.
+ IPC_STRUCT_MEMBER(FrameRoutingIdToContentIdMap,
+ frame_routing_id_to_content_id)
+
+ // |digests_of_uris_to_skip| contains digests of uris of MHTML parts that
+ // should be skipped. This helps deduplicate mhtml parts across frames.
+ // SECURITY NOTE: Sha256 digests (rather than uris) are used to prevent
+ // disclosing uris to other renderer processes; the digests should be
+ // generated using SHA256HashString function from crypto/sha2.h and hashing
+ // |salt + url.spec()|.
+ IPC_STRUCT_MEMBER(std::set<std::string>, digests_of_uris_to_skip)
+
+ // Salt used for |digests_of_uris_to_skip|.
+ IPC_STRUCT_MEMBER(std::string, salt)
+
+ // If |is_last_frame| is true, then an MHTML footer will be generated.
+ IPC_STRUCT_MEMBER(bool, is_last_frame)
+IPC_STRUCT_END()
+
#if defined(OS_MACOSX) || defined(OS_ANDROID)
// This message is used for supporting popup menus on Mac OS X and Android using
// native controls. See the FrameHostMsg_ShowPopup message.
@@ -720,28 +763,7 @@ IPC_MESSAGE_ROUTED3(FrameMsg_GetSerializedHtmlWithLocalLinks,
// Serialize target frame and its resources into MHTML and write it into the
// provided destination file handle.
-//
-// When starting generation of a new MHTML document, one needs to start by
-// sending FrameMsg_SerializeAsMHTML for the *main* frame (when handling the
-// main frame, the renderer generates MHTML header + mhtml boundary marker).
-//
-// When serializing the first, main frame of an MHTML document,
-// |mhtml_boundary_marker| should be an empty string. Otherwise it needs to be
-// the marker generated and reported back by the previous
-// FrameHostMsg_SerializeAsMHTMLResponse.
-//
-// For more details about frame to content id map please see
-// WebPageSerializer::generateMHTMLParts method.
-//
-// |is_last_frame| controls whether the serializer in the renderer will
-// emit the MHTML footer.
-using FrameRoutingIdToContentIdMap = std::map<int, std::string>;
-IPC_MESSAGE_ROUTED5(FrameMsg_SerializeAsMHTML,
- int /* job_id (used to match responses to requests) */,
- IPC::PlatformFileForTransit /* destination file handle */,
- std::string /* mhtml boundary marker */,
- FrameRoutingIdToContentIdMap,
- bool /* is last frame */)
+IPC_MESSAGE_ROUTED1(FrameMsg_SerializeAsMHTML, FrameMsg_SerializeAsMHTML_Params)
IPC_MESSAGE_ROUTED1(FrameMsg_SetFrameOwnerProperties,
blink::WebFrameOwnerProperties /* frame_owner_properties */)
@@ -1273,10 +1295,11 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_SerializedHtmlWithLocalLinksResponse,
bool /* end of data? */)
// Response to FrameMsg_SerializeAsMHTML.
-IPC_MESSAGE_ROUTED3(FrameHostMsg_SerializeAsMHTMLResponse,
+IPC_MESSAGE_ROUTED4(FrameHostMsg_SerializeAsMHTMLResponse,
int /* job_id (used to match responses to requests) */,
bool /* true if success, false if error */,
- std::string /* mhtml boundary marker that was used */)
+ std::string /* mhtml boundary marker that was used */,
+ std::set<GURL> /* uris of generated mhtml parts */)
// Sent when the renderer updates hint for importance of a tab.
IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdatePageImportanceSignals,

Powered by Google App Engine
This is Rietveld 408576698