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

Unified Diff: content/browser/download/mhtml_generation_manager.cc

Issue 2540483002: Allow Offline MHTML save operations to succeed even with missing frames.
Patch Set: Address code review comments. Created 4 years, 1 month 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/browser/download/mhtml_generation_manager.cc
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc
index e2ad052318e6a2cf5a9a92ea00880c98fbb1452f..0884890e8e57b06ad92b725d1cc4d810ae0f7f85 100644
--- a/content/browser/download/mhtml_generation_manager.cc
+++ b/content/browser/download/mhtml_generation_manager.cc
@@ -204,19 +204,25 @@ MhtmlSaveStatus MHTMLGenerationManager::Job::SendToNextRenderFrame() {
DCHECK(browser_file_.IsValid());
DCHECK(!pending_frame_tree_node_ids_.empty());
+ int frame_tree_node_id = pending_frame_tree_node_ids_.front();
+ pending_frame_tree_node_ids_.pop();
+ FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id);
+ if (!ftn) { // A previously existing frame went away.
+ if (!params_.ignore_missing_frames)
+ return MhtmlSaveStatus::FRAME_NO_LONGER_EXISTS;
+ else if (pending_frame_tree_node_ids_.empty())
+ return MhtmlSaveStatus::SUCCESS;
+ else
+ return SendToNextRenderFrame();
+ }
+
FrameMsg_SerializeAsMHTML_Params ipc_params;
ipc_params.job_id = job_id_;
ipc_params.mhtml_boundary_marker = mhtml_boundary_marker_;
ipc_params.mhtml_binary_encoding = params_.use_binary_encoding;
ipc_params.mhtml_cache_control_policy = params_.cache_control_policy;
-
- int frame_tree_node_id = pending_frame_tree_node_ids_.front();
- pending_frame_tree_node_ids_.pop();
ipc_params.is_last_frame = pending_frame_tree_node_ids_.empty();
- FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id);
- if (!ftn) // The contents went away.
- return MhtmlSaveStatus::FRAME_NO_LONGER_EXISTS;
RenderFrameHost* rfh = ftn->current_frame_host();
// Get notified if the target of the IPC message dies between responding.
« no previous file with comments | « content/browser/download/mhtml_generation_browsertest.cc ('k') | content/public/common/mhtml_generation_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698