Chromium Code Reviews| Index: chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc |
| diff --git a/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc b/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc |
| index 7cd7c0d624ced81be3d0ff6f67599c1e073b736c..c5dcabbf6c0e1414d52b8900e85e1d43d1a0652f 100644 |
| --- a/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc |
| +++ b/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc |
| @@ -52,6 +52,7 @@ class WebContentsEntry : public content::WebContentsObserver { |
| const std::vector<content::FaviconURL>& candidates) override; |
| private: |
| + friend class WebContentsTaskProvider; |
|
ncarter (slow)
2015/06/19 19:50:51
WebContentsTaskProvider is the only class that can
afakhry
2015/06/19 21:49:22
Done.
|
| // Defines a callback for WebContents::ForEachFrame() to create a |
| // corresponding task for the given |render_frame_host| and notifying the |
| // provider's observer of the new task. |
| @@ -282,6 +283,21 @@ void WebContentsTaskProvider::OnWebContentsTagCreated(WebContentsTag* tag) { |
| entry->CreateAllTasks(); |
| } |
| +void WebContentsTaskProvider::OnWebContentsTagRemoved(WebContentsTag* tag) { |
| + DCHECK(tag); |
| + content::WebContents* web_contents = tag->web_contents(); |
| + DCHECK(web_contents); |
| + |
| + auto itr = entries_map_.find(web_contents); |
| + DCHECK(itr != entries_map_.end()); |
| + WebContentsEntry* entry = itr->second; |
| + |
| + // Must manually clear the tasks and notifying the observer. |
|
ncarter (slow)
2015/06/19 19:50:51
notifying->notify
afakhry
2015/06/19 21:49:22
Done.
|
| + entry->ClearAllTasks(true); |
| + entries_map_.erase(itr); |
| + delete entry; |
| +} |
| + |
| Task* WebContentsTaskProvider::GetTaskOfUrlRequest(int origin_pid, |
| int child_id, |
| int route_id) { |