diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 17:27:45 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 17:27:45 +0000 |
commit | 76543b9c43515c8c68413b25d682b7c15a151905 (patch) | |
tree | 3fa26b07a2de8102561d5ded5828797fa9a375ab /chrome/browser/download | |
parent | f341f8f58ceeae4efe38daf3c26ad4581f98fd2d (diff) | |
download | chromium_src-76543b9c43515c8c68413b25d682b7c15a151905.zip chromium_src-76543b9c43515c8c68413b25d682b7c15a151905.tar.gz chromium_src-76543b9c43515c8c68413b25d682b7c15a151905.tar.bz2 |
Replace the RenderProcessHost.PID function that returns the OS-generated
process ID with an internally-generated id() function. This allows us the
guarantee that the IDs are unique over the entire run of the application.
This also cleans up some code associated with managing the PID.
The main potentially interesting change is now the PID is set uniquely for
every creation of RenderProcessHost. It used to be set cleared if the process
went away, and re-set if the process was re-created. The ID generation is in
ChildProcesInfo so it is also unique between workers and plugins. I had to
change some significant things in resource_dispatcher_host_unittest to take
into account this new generation of IDs.
BUG=17828
TEST=none
Review URL: http://codereview.chromium.org/160203
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_file.cc | 14 | ||||
-rw-r--r-- | chrome/browser/download/download_file.h | 4 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 14 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 8 |
4 files changed, 19 insertions, 21 deletions
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index bf439f0..246e5b8 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -60,7 +60,7 @@ DownloadFile::DownloadFile(const DownloadCreateInfo* info) source_url_(info->url), referrer_url_(info->referrer_url), id_(info->download_id), - render_process_id_(info->render_process_id), + child_id_(info->child_id), render_view_id_(info->render_view_id), request_id_(info->request_id), bytes_so_far_(0), @@ -244,7 +244,7 @@ void DownloadFileManager::StartDownload(DownloadCreateInfo* info) { // on the UI thread is the safe way to do that. ui_loop_->PostTask(FROM_HERE, NewRunnableFunction(&DownloadManager::CancelDownloadRequest, - info->render_process_id, + info->child_id, info->request_id)); delete info; delete download; @@ -370,12 +370,10 @@ void DownloadFileManager::UpdateInProgressDownloads() { // there will be no 'render_process_id' or 'render_view_id'. void DownloadFileManager::OnStartDownload(DownloadCreateInfo* info) { DCHECK(MessageLoop::current() == ui_loop_); - DownloadManager* manager = - DownloadManagerFromRenderIds(info->render_process_id, - info->render_view_id); + DownloadManager* manager = DownloadManagerFromRenderIds(info->child_id, + info->render_view_id); if (!manager) { - DownloadManager::CancelDownloadRequest(info->render_process_id, - info->request_id); + DownloadManager::CancelDownloadRequest(info->child_id, info->request_id); delete info; return; } @@ -585,7 +583,7 @@ void DownloadFileManager::OnFinalDownloadName(int id, } else { ui_loop_->PostTask(FROM_HERE, NewRunnableFunction(&DownloadManager::CancelDownloadRequest, - download->render_process_id(), + download->child_id(), download->request_id())); } } diff --git a/chrome/browser/download/download_file.h b/chrome/browser/download/download_file.h index 3527131..4d2336b 100644 --- a/chrome/browser/download/download_file.h +++ b/chrome/browser/download/download_file.h @@ -103,7 +103,7 @@ class DownloadFile { int64 bytes_so_far() const { return bytes_so_far_; } int id() const { return id_; } FilePath full_path() const { return full_path_; } - int render_process_id() const { return render_process_id_; } + int child_id() const { return child_id_; } int render_view_id() const { return render_view_id_; } int request_id() const { return request_id_; } bool path_renamed() const { return path_renamed_; } @@ -131,7 +131,7 @@ class DownloadFile { int id_; // IDs for looking up the tab we are associated with. - int render_process_id_; + int child_id_; int render_view_id_; // Handle for informing the ResourceDispatcherHost of a UI based cancel. diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 9477925..4c4dc9e 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -652,8 +652,8 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { if (!select_file_dialog_.get()) select_file_dialog_ = SelectFileDialog::Create(this); - TabContents* contents = tab_util::GetTabContentsByID( - info->render_process_id, info->render_view_id); + TabContents* contents = tab_util::GetTabContentsByID(info->child_id, + info->render_view_id); SelectFileDialog::FileTypeInfo file_type_info; file_type_info.extensions.resize(1); file_type_info.extensions[0].push_back(info->suggested_path.Extension()); @@ -690,7 +690,7 @@ void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info, info->original_name, info->start_time, info->total_bytes, - info->render_process_id, + info->child_id, info->request_id, info->is_dangerous); download->set_manager(this); @@ -1110,7 +1110,7 @@ void DownloadManager::DownloadUrl(const GURL& url, request_context_->set_referrer_charset(referrer_charset); file_manager_->DownloadUrl(url, referrer, - tab_contents->process()->pid(), + tab_contents->process()->id(), tab_contents->render_view_host()->routing_id(), request_context_.get()); } @@ -1385,7 +1385,7 @@ void DownloadManager::FileSelectionCanceled(void* params) { // download that's already in progress to the temporary location. DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params); DownloadCancelledInternal(info->download_id, - info->render_process_id, + info->child_id, info->request_id); } @@ -1508,8 +1508,8 @@ void DownloadManager::ShowDownloadInBrowser(const DownloadCreateInfo& info, // The 'contents' may no longer exist if the user closed the tab before we get // this start completion event. If it does, tell the origin TabContents to // display its download shelf. - TabContents* contents = - tab_util::GetTabContentsByID(info.render_process_id, info.render_view_id); + TabContents* contents = tab_util::GetTabContentsByID(info.child_id, + info.render_view_id); // If the contents no longer exists, we start the download in the last active // browser. This is not ideal but better than fully hiding the download from diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index c6003e7..e268c34 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -132,7 +132,7 @@ SavePackage::SavePackage(TabContents* web_content, save_type_(save_type), all_save_items_count_(0), wait_state_(INITIALIZE), - tab_id_(web_content->process()->pid()) { + tab_id_(web_content->process()->id()) { DCHECK(web_content); const GURL& current_page_url = tab_contents_->GetURL(); DCHECK(current_page_url.is_valid()); @@ -154,7 +154,7 @@ SavePackage::SavePackage(TabContents* tab_contents) disk_error_occurred_(false), all_save_items_count_(0), wait_state_(INITIALIZE), - tab_id_(tab_contents->process()->pid()) { + tab_id_(tab_contents->process()->id()) { const GURL& current_page_url = tab_contents_->GetURL(); DCHECK(current_page_url.is_valid()); page_url_ = current_page_url; @@ -577,7 +577,7 @@ void SavePackage::CheckFinish() { &SaveFileManager::RenameAllFiles, final_names, dir, - tab_contents_->process()->pid(), + tab_contents_->process()->id(), tab_contents_->render_view_host()->routing_id())); } @@ -720,7 +720,7 @@ void SavePackage::SaveNextFile(bool process_all_remaining_items) { save_item->Start(); file_manager_->SaveURL(save_item->url(), save_item->referrer(), - tab_contents_->process()->pid(), + tab_contents_->process()->id(), tab_contents_->render_view_host()->routing_id(), save_item->save_source(), save_item->full_path(), |