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

Issue 2961423002: [TaskManager] Allow a Task to mutate its PID after creation (Closed)

Created:
3 years, 5 months ago by ncarter (slow)
Modified:
3 years, 4 months ago
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[TaskManager] Allow a Task to mutate its PID after creation Prior to this change, WebContentsTaskProvider would defer task creation if the PID was not known at RenderFrameCreated time. However, for a newly-cloned WebContents, no event ever occurred to re-create the Task once the process finished launching. This was bug 738169. Fix the problem by never deferring task_manager::Task creation; instead, create Tasks for all live, current RenderFrameHosts. If the PID is not known immediately, allow it to be set on the task at a later time (when RenderProcessHost::IsReady() becomes true). Because the TaskManagerImpl was written with the expectation that Tasks have a constant PID, PID mutation is implemented in terms of temporarily removing the task, mutating the PID, and re-adding it. In WebContentsTaskProvider, we no longer need to implement RenderProcessGone. In TaskGroup, don't waste time collecting stats for a null process ID. Tests are added exercising this bug, and its subframe equivalent. Test coverage is added for the PID==0 case, and we ensure that the "Memory" column is populated with something nonzero. BUG=738169 Review-Url: https://codereview.chromium.org/2961423002 Cr-Commit-Position: refs/heads/master@{#491180} Committed: https://chromium.googlesource.com/chromium/src/+/6c760df2f6a9f5d1ce7051be6acfeebc26919774

Patch Set 1 #

Patch Set 2 : Totally change approach; just let Tasks modify their PIDs. #

Total comments: 20

Patch Set 3 : afakhry's fixes #

Total comments: 2

Patch Set 4 : Rework comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+267 lines, -66 lines) Patch
M chrome/browser/task_manager/providers/task.h View 1 2 3 3 chunks +11 lines, -2 lines 0 comments Download
M chrome/browser/task_manager/providers/task.cc View 1 2 4 chunks +27 lines, -3 lines 0 comments Download
M chrome/browser/task_manager/providers/task_provider.h View 1 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/task_manager/providers/task_provider.cc View 1 1 chunk +9 lines, -0 lines 0 comments Download
M chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc View 1 2 9 chunks +65 lines, -28 lines 0 comments Download
M chrome/browser/task_manager/sampling/task_group.cc View 1 2 2 chunks +27 lines, -25 lines 0 comments Download
M chrome/browser/task_manager/task_manager_browsertest.cc View 1 2 2 chunks +104 lines, -8 lines 0 comments Download
M chrome/browser/task_manager/task_manager_browsertest_util.h View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/task_manager/task_manager_browsertest_util.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/task_manager/task_manager_tester.cc View 2 chunks +14 lines, -0 lines 0 comments Download

Messages

Total messages: 42 (33 generated)
ncarter (slow)
Chuck, Ahmed -- let me know what you think
3 years, 5 months ago (2017-07-07 23:13:32 UTC) #22
afakhry
Just a few nits. Thank you for fixing this issue! :) https://codereview.chromium.org/2961423002/diff/20001/chrome/browser/task_manager/providers/task.cc File chrome/browser/task_manager/providers/task.cc (right): ...
3 years, 5 months ago (2017-07-10 17:27:54 UTC) #26
afakhry
Hi, do you plan to continue working on this one?
3 years, 5 months ago (2017-07-18 01:25:25 UTC) #27
afakhry
On 2017/07/18 01:25:25, afakhry wrote: > Hi, do you plan to continue working on this ...
3 years, 4 months ago (2017-07-26 17:09:40 UTC) #28
ncarter (slow)
Finally got back to this one. Thanks for the pings. https://codereview.chromium.org/2961423002/diff/20001/chrome/browser/task_manager/providers/task.cc File chrome/browser/task_manager/providers/task.cc (right): https://codereview.chromium.org/2961423002/diff/20001/chrome/browser/task_manager/providers/task.cc#newcode101 ...
3 years, 4 months ago (2017-07-31 22:30:29 UTC) #31
afakhry
LGTM with nit. Thanks! https://codereview.chromium.org/2961423002/diff/20001/chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc File chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc (right): https://codereview.chromium.org/2961423002/diff/20001/chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc#newcode329 chrome/browser/task_manager/providers/web_contents/web_contents_task_provider.cc:329: if (new_task->process_id() == base::kNullProcessId) { ...
3 years, 4 months ago (2017-08-01 17:25:35 UTC) #34
ncarter (slow)
https://codereview.chromium.org/2961423002/diff/40001/chrome/browser/task_manager/providers/task.h File chrome/browser/task_manager/providers/task.h (right): https://codereview.chromium.org/2961423002/diff/40001/chrome/browser/task_manager/providers/task.h#newcode88 chrome/browser/task_manager/providers/task.h:88: // Temporarily remove a task, change its process ID, ...
3 years, 4 months ago (2017-08-01 23:07:10 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2961423002/60001
3 years, 4 months ago (2017-08-01 23:08:07 UTC) #38
commit-bot: I haz the power
3 years, 4 months ago (2017-08-02 01:41:58 UTC) #42
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/6c760df2f6a9f5d1ce7051be6acf...

Powered by Google App Engine
This is Rietveld 408576698