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

Side by Side Diff: content/browser/download/mhtml_generation_manager.cc

Issue 1874543002: Inside of content, prefer SiteInstanceImpl to SiteInstance. Base URL: https://chromium.googlesource.com/chromium/src.git@site_instance_unittest
Patch Set: Created 4 years, 8 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/mhtml_generation_manager.h" 5 #include "content/browser/download/mhtml_generation_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <queue> 8 #include <queue>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void RenderProcessHostDestroyed(RenderProcessHost* host) override; 72 void RenderProcessHostDestroyed(RenderProcessHost* host) override;
73 73
74 private: 74 private:
75 static int64_t CloseFileOnFileThread(base::File file); 75 static int64_t CloseFileOnFileThread(base::File file);
76 void AddFrame(RenderFrameHost* render_frame_host); 76 void AddFrame(RenderFrameHost* render_frame_host);
77 77
78 // Creates a new map with values (content ids) the same as in 78 // Creates a new map with values (content ids) the same as in
79 // |frame_tree_node_to_content_id_| map, but with the keys translated from 79 // |frame_tree_node_to_content_id_| map, but with the keys translated from
80 // frame_tree_node_id into a |site_instance|-specific routing_id. 80 // frame_tree_node_id into a |site_instance|-specific routing_id.
81 std::map<int, std::string> CreateFrameRoutingIdToContentId( 81 std::map<int, std::string> CreateFrameRoutingIdToContentId(
82 SiteInstance* site_instance); 82 SiteInstanceImpl* site_instance);
83 83
84 // Id used to map renderer responses to jobs. 84 // Id used to map renderer responses to jobs.
85 // See also MHTMLGenerationManager::id_to_job_ map. 85 // See also MHTMLGenerationManager::id_to_job_ map.
86 int job_id_; 86 int job_id_;
87 87
88 // The IDs of frames that still need to be processed. 88 // The IDs of frames that still need to be processed.
89 std::queue<int> pending_frame_tree_node_ids_; 89 std::queue<int> pending_frame_tree_node_ids_;
90 90
91 // Identifies a frame to which we've sent FrameMsg_SerializeAsMHTML but for 91 // Identifies a frame to which we've sent FrameMsg_SerializeAsMHTML but for
92 // which we didn't yet process FrameHostMsg_SerializeAsMHTMLResponse via 92 // which we didn't yet process FrameHostMsg_SerializeAsMHTMLResponse via
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 DCHECK(FrameTreeNode::GloballyFindByID(pending_frame_tree_node_ids_.front()) 136 DCHECK(FrameTreeNode::GloballyFindByID(pending_frame_tree_node_ids_.front())
137 ->parent() == nullptr); 137 ->parent() == nullptr);
138 } 138 }
139 139
140 MHTMLGenerationManager::Job::~Job() { 140 MHTMLGenerationManager::Job::~Job() {
141 DCHECK_CURRENTLY_ON(BrowserThread::UI); 141 DCHECK_CURRENTLY_ON(BrowserThread::UI);
142 } 142 }
143 143
144 std::map<int, std::string> 144 std::map<int, std::string>
145 MHTMLGenerationManager::Job::CreateFrameRoutingIdToContentId( 145 MHTMLGenerationManager::Job::CreateFrameRoutingIdToContentId(
146 SiteInstance* site_instance) { 146 SiteInstanceImpl* site_instance) {
147 std::map<int, std::string> result; 147 std::map<int, std::string> result;
148 for (const auto& it : frame_tree_node_to_content_id_) { 148 for (const auto& it : frame_tree_node_to_content_id_) {
149 int ftn_id = it.first; 149 int ftn_id = it.first;
150 const std::string& content_id = it.second; 150 const std::string& content_id = it.second;
151 151
152 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(ftn_id); 152 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(ftn_id);
153 if (!ftn) 153 if (!ftn)
154 continue; 154 continue;
155 155
156 int routing_id = 156 int routing_id =
(...skipping 14 matching lines...) Expand all
171 ipc_params.job_id = job_id_; 171 ipc_params.job_id = job_id_;
172 ipc_params.mhtml_boundary_marker = mhtml_boundary_marker_; 172 ipc_params.mhtml_boundary_marker = mhtml_boundary_marker_;
173 173
174 int frame_tree_node_id = pending_frame_tree_node_ids_.front(); 174 int frame_tree_node_id = pending_frame_tree_node_ids_.front();
175 pending_frame_tree_node_ids_.pop(); 175 pending_frame_tree_node_ids_.pop();
176 ipc_params.is_last_frame = pending_frame_tree_node_ids_.empty(); 176 ipc_params.is_last_frame = pending_frame_tree_node_ids_.empty();
177 177
178 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id); 178 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id);
179 if (!ftn) // The contents went away. 179 if (!ftn) // The contents went away.
180 return false; 180 return false;
181 RenderFrameHost* rfh = ftn->current_frame_host(); 181 RenderFrameHostImpl* rfh = ftn->current_frame_host();
182 182
183 // Get notified if the target of the IPC message dies between responding. 183 // Get notified if the target of the IPC message dies between responding.
184 observed_renderer_process_host_.RemoveAll(); 184 observed_renderer_process_host_.RemoveAll();
185 observed_renderer_process_host_.Add(rfh->GetProcess()); 185 observed_renderer_process_host_.Add(rfh->GetProcess());
186 186
187 // Tell the renderer to skip (= deduplicate) already covered MHTML parts. 187 // Tell the renderer to skip (= deduplicate) already covered MHTML parts.
188 ipc_params.salt = salt_; 188 ipc_params.salt = salt_;
189 ipc_params.digests_of_uris_to_skip = digests_of_already_serialized_uris_; 189 ipc_params.digests_of_uris_to_skip = digests_of_already_serialized_uris_;
190 190
191 ipc_params.destination_file = IPC::GetFileHandleForProcess( 191 ipc_params.destination_file = IPC::GetFileHandleForProcess(
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return iter->second; 416 return iter->second;
417 } 417 }
418 418
419 void MHTMLGenerationManager::RenderProcessExited(Job* job) { 419 void MHTMLGenerationManager::RenderProcessExited(Job* job) {
420 DCHECK_CURRENTLY_ON(BrowserThread::UI); 420 DCHECK_CURRENTLY_ON(BrowserThread::UI);
421 DCHECK(job); 421 DCHECK(job);
422 JobFinished(job, JobStatus::FAILURE); 422 JobFinished(job, JobStatus::FAILURE);
423 } 423 }
424 424
425 } // namespace content 425 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/browser/frame_host/frame_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698