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

Issue 2875673003: [Memory-UMA] Add ProcessMap, an Identity to Pid map (Closed)

Created:
3 years, 7 months ago by fmeawad
Modified:
3 years, 7 months ago
Reviewers:
erikchen
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Memory-UMA] Add ProcessMap, an Identity to Pid map PROTOTYPE, DO NOT LAND BUG=703184

Patch Set 1 #

Patch Set 2 : Add dispatch_context() call to bind process_manager to Identity #

Patch Set 3 : Split Process Map into its own files #

Total comments: 15

Patch Set 4 : Address Erik's comments #

Total comments: 1

Patch Set 5 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+180 lines, -11 lines) Patch
M content/public/app/mojo/content_browser_manifest.json View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M services/resource_coordinator/BUILD.gn View 1 2 4 1 chunk +2 lines, -0 lines 0 comments Download
M services/resource_coordinator/memory/coordinator/coordinator_impl.h View 1 2 3 4 4 chunks +10 lines, -2 lines 0 comments Download
M services/resource_coordinator/memory/coordinator/coordinator_impl.cc View 1 2 3 4 7 chunks +42 lines, -9 lines 0 comments Download
A services/resource_coordinator/memory/coordinator/process_map.h View 1 2 3 1 chunk +51 lines, -0 lines 0 comments Download
A services/resource_coordinator/memory/coordinator/process_map.cc View 1 2 3 1 chunk +60 lines, -0 lines 0 comments Download
M services/service_manager/public/cpp/identity.h View 1 2 3 2 chunks +14 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (1 generated)
erikchen
https://codereview.chromium.org/2875673003/diff/40001/services/resource_coordinator/memory/coordinator/coordinator_impl.cc File services/resource_coordinator/memory/coordinator/coordinator_impl.cc (right): https://codereview.chromium.org/2875673003/diff/40001/services/resource_coordinator/memory/coordinator/coordinator_impl.cc#newcode120 services/resource_coordinator/memory/coordinator/coordinator_impl.cc:120: process_manager.get(), std::move(process_manager))); Given that we're already maintaining a map ...
3 years, 7 months ago (2017-05-12 17:56:15 UTC) #2
fmeawad
3 years, 7 months ago (2017-05-12 23:08:14 UTC) #3
https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
File services/resource_coordinator/memory/coordinator/coordinator_impl.cc
(right):

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
services/resource_coordinator/memory/coordinator/coordinator_impl.cc:120:
process_manager.get(), std::move(process_manager)));
On 2017/05/12 17:56:15, erikchen wrote:
> Given that we're already maintaining a map from
mojom::ProcessLocalDumpManager*
> to <something else>, wouldn't it be simplest to also add the identity to this
> map?
> 
> That way Line 180 can be:
> Look up in identity in process_managers_, then look up pid from identity in
the
> process_map_. This in turn makes process_map_ simpler and eliminates a
redundant
> structure.

Done.

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
services/resource_coordinator/memory/coordinator/coordinator_impl.cc:211: if
(content::ServiceManagerConnection::GetForProcess()) {
On 2017/05/12 17:56:15, erikchen wrote:
> Given that you have a DCHECK on line 114, this should be
> 
> ServiceManagerConnection*c =
content::ServiceManagerConnection::GetForProcess();
> DCHECK(c);

Done.

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
services/resource_coordinator/memory/coordinator/coordinator_impl.cc:212:
service_manager::mojom::ServiceManagerPtr service_manager;
On 2017/05/12 17:56:15, erikchen wrote:
> does this work? Don't you need to keep service_manager alive in order for the
> callbacks to go through?

Unless I am reading this code:
https://cs.chromium.org/chromium/src/mash/task_viewer/task_viewer.cc?l=318
incorrectly, then no.

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
File services/resource_coordinator/memory/coordinator/coordinator_impl.h
(right):

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
services/resource_coordinator/memory/coordinator/coordinator_impl.h:96:
ProcessMap* process_map_;
On 2017/05/12 17:56:15, erikchen wrote:
> unique_ptr

Done.

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
File services/resource_coordinator/memory/coordinator/process_map.h (right):

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
services/resource_coordinator/memory/coordinator/process_map.h:21: class
ProcessMap : public service_manager::mojom::ServiceManagerListener {
On 2017/05/12 17:56:15, erikchen wrote:
> This class deserves a comment, maybe something like:
> 
> Maintains an unordered_map from mojom::ProcessLocalDumpManager* to
> service_manager::Identity, and another from service_manager::Identity to
> base::ProcessId pid;. This allows |pid| lookup by
> mojom::ProcessLocalDumpManager.
> 
> Two questions:
> 1) Should instances_ be an unordered_map instead of a vector? Requires
defining
> a hash function, etc.
> 2) Should there be a cache from mojom::ProcessLocalDumpManager* to |pid|?
> Probably not?

1) Yes
2) Should the cache live here? since we moved the identity out, does it still
make sense?

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
services/resource_coordinator/memory/coordinator/process_map.h:23:
ProcessMap(service_manager::mojom::ServiceManagerListenerRequest request);
On 2017/05/12 17:56:15, erikchen wrote:
> explicit

Done.

https://codereview.chromium.org/2875673003/diff/40001/services/resource_coord...
services/resource_coordinator/memory/coordinator/process_map.h:26: void
AddProcess(mojom::ProcessLocalDumpManager* process_manager,
On 2017/05/12 17:56:15, erikchen wrote:
> this makes the assumption that the destructor of a registered
> mojom::ProcessLocalDumpManager is guaranteed to invoke RemoveProcess. Is this
> the case? I can't tell.
> 

No longer needed since it was moved into the other map

https://codereview.chromium.org/2875673003/diff/60001/services/resource_coord...
File services/resource_coordinator/memory/coordinator/coordinator_impl.cc
(right):

https://codereview.chromium.org/2875673003/diff/60001/services/resource_coord...
services/resource_coordinator/memory/coordinator/coordinator_impl.cc:217:
content::ServiceManagerConnection::GetForProcess()
Service cannot use content, this call need to be moved out of here.

Powered by Google App Engine
This is Rietveld 408576698