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

Issue 2434353003: Introduce MemoryCoordinatorProxy in base (Closed)

Created:
4 years, 2 months ago by hajimehoshi
Modified:
4 years, 1 month ago
CC:
chromium-reviews, jam, darin-cc_chromium.org, gavinp+memory_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce MemoryCoordinatorProxy in base This CL instroduces a new class MemoryCoordinatorProxy that is the proxy of MemoryCoordinator in content/browser. MemoryCoordinator:: GetCurrentMemoryState to get the current memory state is now not accessible by some MemoryCoordinatorClients, and MemoryCoordinatorProxy offers the proxy function to access this. This is used to get the current memory state by e.g. TabLoader in chrome/browser or components in net. BUG=639700 Committed: https://crrev.com/3524bd796cb8b8c57815dfa324e4cc66a74f5336 Cr-Commit-Position: refs/heads/master@{#427027}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Address on reviews #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -13 lines) Patch
M base/BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
A base/memory/memory_coordinator_proxy.h View 1 chunk +42 lines, -0 lines 2 comments Download
A base/memory/memory_coordinator_proxy.cc View 1 chunk +30 lines, -0 lines 4 comments Download
M content/browser/browser_main_loop.cc View 1 2 chunks +7 lines, -0 lines 0 comments Download
M content/browser/memory/memory_coordinator.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/memory/memory_coordinator.cc View 1 1 chunk +8 lines, -0 lines 0 comments Download
M content/browser/memory/memory_coordinator_browsertest.cc View 1 1 chunk +1 line, -13 lines 0 comments Download
M content/browser/memory/memory_coordinator_impl_unittest.cc View 1 5 chunks +23 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 24 (9 generated)
hajimehoshi
PTAL
4 years, 2 months ago (2016-10-21 12:02:17 UTC) #2
Avi (use Gerrit)
On 2016/10/21 12:02:17, hajimehoshi wrote: > PTAL So the content code lgtm, but the design ...
4 years, 2 months ago (2016-10-21 13:01:18 UTC) #5
chrisha
On 2016/10/21 13:01:18, Avi wrote: > On 2016/10/21 12:02:17, hajimehoshi wrote: > > PTAL > ...
4 years, 2 months ago (2016-10-21 18:41:09 UTC) #8
Avi (use Gerrit)
No... Sigh. That sounds like a reasonable plan given the situation we're in. I... just ...
4 years, 2 months ago (2016-10-21 18:45:23 UTC) #9
danakj
base LGTM with similar feelings. https://codereview.chromium.org/2434353003/diff/1/content/browser/browser_main_loop.cc File content/browser/browser_main_loop.cc (right): https://codereview.chromium.org/2434353003/diff/1/content/browser/browser_main_loop.cc#newcode1400 content/browser/browser_main_loop.cc:1400: base::Unretained(MemoryCoordinator::GetInstance()))); Can you leave ...
4 years, 2 months ago (2016-10-21 18:56:30 UTC) #10
bashi
lgtm https://codereview.chromium.org/2434353003/diff/1/content/browser/memory/memory_coordinator_impl_unittest.cc File content/browser/memory/memory_coordinator_impl_unittest.cc (right): https://codereview.chromium.org/2434353003/diff/1/content/browser/memory/memory_coordinator_impl_unittest.cc#newcode56 content/browser/memory/memory_coordinator_impl_unittest.cc:56: std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); nit: Can we move out ...
4 years, 2 months ago (2016-10-24 00:10:25 UTC) #12
hajimehoshi
Thank you! https://codereview.chromium.org/2434353003/diff/1/content/browser/browser_main_loop.cc File content/browser/browser_main_loop.cc (right): https://codereview.chromium.org/2434353003/diff/1/content/browser/browser_main_loop.cc#newcode1400 content/browser/browser_main_loop.cc:1400: base::Unretained(MemoryCoordinator::GetInstance()))); On 2016/10/21 18:56:30, danakj wrote: > ...
4 years, 1 month ago (2016-10-24 06:51:06 UTC) #13
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/2434353003/20001
4 years, 1 month ago (2016-10-24 06:53:14 UTC) #16
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 1 month ago (2016-10-24 07:55:10 UTC) #17
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/3524bd796cb8b8c57815dfa324e4cc66a74f5336 Cr-Commit-Position: refs/heads/master@{#427027}
4 years, 1 month ago (2016-10-24 07:58:31 UTC) #19
haraken
LGTM https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc File base/memory/memory_coordinator_proxy.cc (right): https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc#newcode21 base/memory/memory_coordinator_proxy.cc:21: return MemoryState::NORMAL; Is this an expected behavior? I ...
4 years, 1 month ago (2016-10-24 09:01:16 UTC) #20
hajimehoshi
https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc File base/memory/memory_coordinator_proxy.cc (right): https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc#newcode21 base/memory/memory_coordinator_proxy.cc:21: return MemoryState::NORMAL; On 2016/10/24 09:01:15, haraken wrote: > > ...
4 years, 1 month ago (2016-10-24 10:56:52 UTC) #21
haraken
https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc File base/memory/memory_coordinator_proxy.cc (right): https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc#newcode21 base/memory/memory_coordinator_proxy.cc:21: return MemoryState::NORMAL; On 2016/10/24 10:56:52, hajimehoshi wrote: > On ...
4 years, 1 month ago (2016-10-24 11:35:39 UTC) #22
bashi
https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc File base/memory/memory_coordinator_proxy.cc (right): https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coordinator_proxy.cc#newcode21 base/memory/memory_coordinator_proxy.cc:21: return MemoryState::NORMAL; On 2016/10/24 11:35:39, haraken wrote: > On ...
4 years, 1 month ago (2016-10-24 23:35:57 UTC) #23
haraken
4 years, 1 month ago (2016-10-25 05:07:50 UTC) #24
Message was sent while issue was closed.
On 2016/10/24 23:35:57, bashi1 wrote:
>
https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coor...
> File base/memory/memory_coordinator_proxy.cc (right):
> 
>
https://codereview.chromium.org/2434353003/diff/20001/base/memory/memory_coor...
> base/memory/memory_coordinator_proxy.cc:21: return MemoryState::NORMAL;
> On 2016/10/24 11:35:39, haraken wrote:
> > On 2016/10/24 10:56:52, hajimehoshi wrote:
> > > On 2016/10/24 09:01:15, haraken wrote:
> > > > 
> > > > Is this an expected behavior?
> > > > 
> > > > I guess it's better to force all processes install the callback
function,
> > and
> > > > add DHECK(callback_).
> > > 
> > > Hmm, why we decided to use NORMAL as default is because the feature list
> might
> > > not be initialized before a MemoryCoordinatorClient is created. This was
> > needed
> > > when the current memory state needed to be known at such client's
> constructor.
> > > Now there are not actual such cases, but can we assume 
> > > MemoryCoordinatorProxy::GetCurrentMemoryState is called AFTER the feature
> list
> > > is initialized now?
> > 
> > I think the feature list should be initialized at the very beginning of the
> > browser/renderer execution. Otherwise, it will confuse many things. Is it
not
> > true?
> > 
> 
> It's probably true, but I think it's better to return the default state
(NORMAL)
> when callback_ is not set. Here are some reasons:
> - It's hard to make sure that all callsites wait for memory coordinator
> initialization. We can't initialize MC until base::FeatureList must be
> initialized, but some MemoryCoordinatorClients (e.g. clients in cc/) are
> instanciated before base::FeatureList is initialized.
> - In tests we may not install a callback. base/ should work without depending
> other components.

Thanks, makes sense.

Powered by Google App Engine
This is Rietveld 408576698