Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/task_management/providers/web_contents/web_contents_tas k_provider.h" | 5 #include "chrome/browser/task_management/providers/web_contents/web_contents_tas k_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "chrome/browser/task_management/providers/web_contents/subframe_task.h" | 10 #include "chrome/browser/task_management/providers/web_contents/subframe_task.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 RendererTask* new_task = nullptr; | 223 RendererTask* new_task = nullptr; |
| 224 // We don't create a task if there's one for this site_instance AND | 224 // We don't create a task if there's one for this site_instance AND |
| 225 // if this is not the main frame or we did record a main frame for the entry. | 225 // if this is not the main frame or we did record a main frame for the entry. |
| 226 if (!site_instance_exists || (is_main_frame && !site_instance_is_main)) { | 226 if (!site_instance_exists || (is_main_frame && !site_instance_is_main)) { |
| 227 if (is_main_frame) { | 227 if (is_main_frame) { |
| 228 const WebContentsTag* tag = | 228 const WebContentsTag* tag = |
| 229 WebContentsTag::FromWebContents(web_contents()); | 229 WebContentsTag::FromWebContents(web_contents()); |
| 230 new_task = tag->CreateTask(); | 230 new_task = tag->CreateTask(); |
| 231 main_frame_site_instance_ = site_instance; | 231 main_frame_site_instance_ = site_instance; |
| 232 } else { | 232 } else { |
| 233 new_task = new SubframeTask(render_frame_host, web_contents()); | 233 new_task = |
| 234 new SubframeTask(render_frame_host, web_contents(), | |
| 235 GetTaskForFrame(web_contents()->GetMainFrame())); | |
|
afakhry
2016/05/25 20:07:09
I hope the task of the main frame gets created bef
ncarter (slow)
2016/05/25 20:34:23
Yes; the way we use WebContentsObserver guarantees
| |
| 234 } | 236 } |
| 235 } | 237 } |
| 236 | 238 |
| 237 if (site_instance_exists) { | 239 if (site_instance_exists) { |
| 238 // One of the existing frame hosts for this site instance. | 240 // One of the existing frame hosts for this site instance. |
| 239 FramesList& existing_frames_for_site_instance = | 241 FramesList& existing_frames_for_site_instance = |
| 240 frames_by_site_instance_[site_instance]; | 242 frames_by_site_instance_[site_instance]; |
| 241 RenderFrameHost* existing_rfh = existing_frames_for_site_instance[0]; | 243 RenderFrameHost* existing_rfh = existing_frames_for_site_instance[0]; |
| 242 RendererTask* old_task = tasks_by_frames_[existing_rfh]; | 244 RendererTask* old_task = tasks_by_frames_[existing_rfh]; |
| 243 | 245 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 | 394 |
| 393 WebContentsEntry* entry = itr->second; | 395 WebContentsEntry* entry = itr->second; |
| 394 entries_map_.erase(itr); | 396 entries_map_.erase(itr); |
| 395 | 397 |
| 396 // The entry we're about to delete is our caller, however its' still fine to | 398 // The entry we're about to delete is our caller, however its' still fine to |
| 397 // delete it. | 399 // delete it. |
| 398 delete entry; | 400 delete entry; |
| 399 } | 401 } |
| 400 | 402 |
| 401 } // namespace task_management | 403 } // namespace task_management |
| OLD | NEW |