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

Issue 17106004: Add discardable memory emulation for non-android/mac platforms (Closed)

Created:
7 years, 6 months ago by Ian Vollick
Modified:
7 years, 1 month ago
CC:
chromium-reviews, erikwright+watch_chromium.org, gavinp+memory_chromium.org
Visibility:
Public.

Description

Add discardable memory emulation for non-android/mac platforms Adds support for emulated discardable memory. The memory is managed by a provider which listens for memory pressure notifications from the platform. Currently, only android pushes these notifications, but in future patches, we will apply pressure on other platforms in certain situations (e.g., when a tab gets backgrounded). BUG=237681 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=231845

Patch Set 1 : . #

Total comments: 7

Patch Set 2 : . #

Total comments: 5

Patch Set 3 : . #

Total comments: 4

Patch Set 4 : . #

Patch Set 5 : . #

Patch Set 6 : . #

Total comments: 12

Patch Set 7 : . #

Patch Set 8 : . #

Patch Set 9 : . #

Total comments: 1

Patch Set 10 : . #

Patch Set 11 : DiscardableMemory cannot inherit from NonThreadSafe. Also unnecessary: skia implements its own sync… #

Patch Set 12 : . #

Patch Set 13 : . #

Total comments: 24

Patch Set 14 : Addressing review. #

Total comments: 24

Patch Set 15 : refactor #

Patch Set 16 : add test that use discardable memory on thread #

Patch Set 17 : #

Patch Set 18 : s/ASSERT_/EXPECT_/ #

Total comments: 10

Patch Set 19 : address review feedback #

Total comments: 14

Patch Set 20 : rebase and address review feedback #

Total comments: 2

Patch Set 21 : parameterize some tests #

Patch Set 22 : Fix MemoryAfterUnlock test #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+880 lines, -66 lines) Patch
M base/base.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +6 lines, -0 lines 0 comments Download
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +11 lines, -1 line 0 comments Download
M base/containers/mru_cache.h View 1 2 chunks +7 lines, -2 lines 0 comments Download
M base/memory/discardable_memory.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +6 lines, -2 lines 0 comments Download
D base/memory/discardable_memory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -39 lines 0 comments Download
M base/memory/discardable_memory_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +1 line, -1 line 0 comments Download
A base/memory/discardable_memory_emulated.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +85 lines, -0 lines 1 comment Download
M base/memory/discardable_memory_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +1 line, -1 line 0 comments Download
A base/memory/discardable_memory_provider.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +151 lines, -0 lines 0 comments Download
A base/memory/discardable_memory_provider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +240 lines, -0 lines 0 comments Download
A base/memory/discardable_memory_provider_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +347 lines, -0 lines 0 comments Download
M base/memory/discardable_memory_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 chunks +14 lines, -10 lines 0 comments Download
M build/common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +11 lines, -6 lines 0 comments Download
M skia/ext/SkDiscardableMemory_chrome.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -2 lines 0 comments Download
M webkit/child/webkitplatformsupport_child_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -2 lines 0 comments Download

Messages

Total messages: 53 (0 generated)
Ian Vollick
I've started to split the original patch (https://codereview.chromium.org/15650016/) up into pieces. This patch is the ...
7 years, 6 months ago (2013-06-15 01:10:51 UTC) #1
cpu_(ooo_6.6-7.5)
looking nice, I am going to be ooo monday. Thanks for your patience.
7 years, 6 months ago (2013-06-15 02:38:38 UTC) #2
Avi (use Gerrit)
https://codereview.chromium.org/17106004/diff/8001/base/containers/mru_cache.h File base/containers/mru_cache.h (right): https://codereview.chromium.org/17106004/diff/8001/base/containers/mru_cache.h#newcode127 base/containers/mru_cache.h:127: // TODO(brettw) We may want a const version of ...
7 years, 6 months ago (2013-06-18 00:00:46 UTC) #3
Ian Vollick
On 2013/06/18 00:00:46, Avi wrote: > https://codereview.chromium.org/17106004/diff/8001/base/containers/mru_cache.h > File base/containers/mru_cache.h (right): > > https://codereview.chromium.org/17106004/diff/8001/base/containers/mru_cache.h#newcode127 > ...
7 years, 6 months ago (2013-06-19 21:13:58 UTC) #4
Avi (use Gerrit)
On 2013/06/19 21:13:58, vollick wrote: > I was thinking that when we add win support, ...
7 years, 6 months ago (2013-06-20 20:29:31 UTC) #5
Avi (use Gerrit)
On 2013/06/20 20:29:31, Avi wrote: > On 2013/06/19 21:13:58, vollick wrote: > > I was ...
7 years, 6 months ago (2013-06-20 20:32:17 UTC) #6
Ian Vollick
On 2013/06/20 20:29:31, Avi wrote: > On 2013/06/19 21:13:58, vollick wrote: > > I was ...
7 years, 6 months ago (2013-06-20 20:38:28 UTC) #7
Ian Vollick
On 2013/06/20 20:32:17, Avi wrote: > On 2013/06/20 20:29:31, Avi wrote: > > On 2013/06/19 ...
7 years, 6 months ago (2013-06-20 20:39:07 UTC) #8
Avi (use Gerrit)
https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory_emulated.cc File base/memory/discardable_memory_emulated.cc (right): https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory_emulated.cc#newcode13 base/memory/discardable_memory_emulated.cc:13: return true; :/ so this always returns true. For ...
7 years, 6 months ago (2013-06-20 20:47:41 UTC) #9
Ian Vollick
On 2013/06/20 20:47:41, Avi wrote: > https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory_emulated.cc > File base/memory/discardable_memory_emulated.cc (right): > > https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory_emulated.cc#newcode13 > ...
7 years, 6 months ago (2013-06-20 21:10:20 UTC) #10
Avi (use Gerrit)
https://codereview.chromium.org/17106004/diff/27001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/27001/base/memory/discardable_memory.h#newcode21 base/memory/discardable_memory.h:21: #define DISCARDABLE_MEMORY_SUPPORTED_NATIVELY If there is now a runtime call, ...
7 years, 6 months ago (2013-06-20 21:16:40 UTC) #11
cpu_(ooo_6.6-7.5)
https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory.h#newcode29 base/memory/discardable_memory.h:29: // flexibility as to which objects get discarded. I ...
7 years, 6 months ago (2013-06-20 21:30:16 UTC) #12
Ian Vollick
https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/16001/base/memory/discardable_memory.h#newcode29 base/memory/discardable_memory.h:29: // flexibility as to which objects get discarded. On ...
7 years, 6 months ago (2013-06-20 23:27:09 UTC) #13
Avi (use Gerrit)
LGTM https://codereview.chromium.org/17106004/diff/27001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/27001/base/memory/discardable_memory.h#newcode21 base/memory/discardable_memory.h:21: #define DISCARDABLE_MEMORY_SUPPORTED_NATIVELY On 2013/06/20 23:27:09, vollick wrote: > ...
7 years, 6 months ago (2013-06-20 23:29:56 UTC) #14
cpu_(ooo_6.6-7.5)
LGTM I still feel fuzzy about the threading situation, for future CLs consider deriving from ...
7 years, 6 months ago (2013-06-21 00:12:40 UTC) #15
Ian Vollick
+willchan for base/ OWNERS +darin for webkit/ OWNERS On 2013/06/21 00:12:40, cpu wrote: > LGTM ...
7 years, 6 months ago (2013-06-21 13:24:17 UTC) #16
cpu_(ooo_6.6-7.5)
lgtm
7 years, 6 months ago (2013-06-25 19:05:55 UTC) #17
willchan no longer on Chromium
https://codereview.chromium.org/17106004/diff/40001/base/memory/discardable_memory.cc File base/memory/discardable_memory.cc (right): https://codereview.chromium.org/17106004/diff/40001/base/memory/discardable_memory.cc#newcode24 base/memory/discardable_memory.cc:24: CHECK(false); Weird, why not just do CHECK(is_locked_);? https://codereview.chromium.org/17106004/diff/40001/base/memory/discardable_memory_provider.h File ...
7 years, 6 months ago (2013-06-25 21:06:50 UTC) #18
Ian Vollick
Darin, can you PTAL? https://codereview.chromium.org/17106004/diff/40001/base/memory/discardable_memory.cc File base/memory/discardable_memory.cc (right): https://codereview.chromium.org/17106004/diff/40001/base/memory/discardable_memory.cc#newcode24 base/memory/discardable_memory.cc:24: CHECK(false); On 2013/06/25 21:06:50, willchan ...
7 years, 6 months ago (2013-06-26 01:10:13 UTC) #19
Ian Vollick
-darin (unavailable) Tony, Will -- are you able to do an OWNERS review for this ...
7 years, 5 months ago (2013-07-03 13:26:47 UTC) #20
tony
rubberstamp webkit LGTM.
7 years, 5 months ago (2013-07-03 16:40:55 UTC) #21
willchan no longer on Chromium
I'm sorry, I'm going out on another trip tomorrow and will return on the 15th, ...
7 years, 5 months ago (2013-07-05 19:23:39 UTC) #22
Ian Vollick
Hi Brett, Will's not able to do this review. Would you be able to take ...
7 years, 5 months ago (2013-07-05 23:04:18 UTC) #23
rmcilroy_google
https://codereview.chromium.org/17106004/diff/50001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/50001/base/memory/discardable_memory.h#newcode25 base/memory/discardable_memory.h:25: #endif Just to point out that if https://codereview.chromium.org/18910002/ lands ...
7 years, 5 months ago (2013-07-10 14:48:48 UTC) #24
Peter Mayo
https://codereview.chromium.org/17106004/diff/79001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/17106004/diff/79001/build/common.gypi#newcode3984 build/common.gypi:3984: 'defines': ['DISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY'], I don't quite understand why we need ...
7 years, 4 months ago (2013-08-08 22:29:57 UTC) #25
Avi (use Gerrit)
On 2013/08/08 22:29:57, Peter Mayo wrote: > Are there systems that sometimes support discardable memory ...
7 years, 4 months ago (2013-08-08 22:43:17 UTC) #26
Ian Vollick
On 2013/08/08 22:43:17, Avi wrote: > On 2013/08/08 22:29:57, Peter Mayo wrote: > > Are ...
7 years, 4 months ago (2013-08-09 12:30:36 UTC) #27
willchan no longer on Chromium
https://codereview.chromium.org/17106004/diff/89001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/89001/base/memory/discardable_memory.h#newcode102 base/memory/discardable_memory.h:102: bool Allocate(); Please document the return value. https://codereview.chromium.org/17106004/diff/89001/base/memory/discardable_memory_emulated.cc File ...
7 years, 3 months ago (2013-08-27 03:23:15 UTC) #28
Ian Vollick
Thanks for the review! https://codereview.chromium.org/17106004/diff/89001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/89001/base/memory/discardable_memory.h#newcode102 base/memory/discardable_memory.h:102: bool Allocate(); On 2013/08/27 03:23:15, ...
7 years, 3 months ago (2013-09-24 17:15:24 UTC) #29
Ian Vollick
On 2013/09/24 17:15:24, Ian Vollick wrote: > Thanks for the review! > > https://codereview.chromium.org/17106004/diff/89001/base/memory/discardable_memory.h > ...
7 years, 3 months ago (2013-09-24 23:38:16 UTC) #30
willchan no longer on Chromium
Still reviewing the provider code, but had some comments beforehand. https://codereview.chromium.org/17106004/diff/102001/base/memory/discardable_memory.h File base/memory/discardable_memory.h (right): https://codereview.chromium.org/17106004/diff/102001/base/memory/discardable_memory.h#newcode16 ...
7 years, 2 months ago (2013-10-01 18:12:04 UTC) #31
willchan no longer on Chromium
https://codereview.chromium.org/17106004/diff/102001/base/memory/discardable_memory_provider.cc File base/memory/discardable_memory_provider.cc (right): https://codereview.chromium.org/17106004/diff/102001/base/memory/discardable_memory_provider.cc#newcode46 base/memory/discardable_memory_provider.cc:46: for (; it != allocations_.end(); ++it) Mind putting braces ...
7 years, 2 months ago (2013-10-01 18:47:25 UTC) #32
willchan no longer on Chromium
https://codereview.chromium.org/17106004/diff/102001/base/memory/discardable_memory_provider_unittest.cc File base/memory/discardable_memory_provider_unittest.cc (right): https://codereview.chromium.org/17106004/diff/102001/base/memory/discardable_memory_provider_unittest.cc#newcode78 base/memory/discardable_memory_provider_unittest.cc:78: ASSERT_NE(static_cast<void*>(NULL), Memory(discardable)); You should use EXPECT_*() unless the following ...
7 years, 2 months ago (2013-10-01 19:05:05 UTC) #33
reveman
Hi all! I'm picking up this patch as it's needed for the new image cache ...
7 years, 2 months ago (2013-10-09 22:40:23 UTC) #34
willchan no longer on Chromium
FYI, I'm at a conference for this week, so I'll be slow. On Wed, Oct ...
7 years, 2 months ago (2013-10-10 16:46:57 UTC) #35
willchan no longer on Chromium
Hey David, I started looking at this. Sorry for the delay. pliard is near the ...
7 years, 2 months ago (2013-10-17 01:29:40 UTC) #36
reveman
On 2013/10/17 01:29:40, willchan wrote: > Hey David, I started looking at this. Sorry for ...
7 years, 2 months ago (2013-10-17 01:45:48 UTC) #37
willchan no longer on Chromium
If you have a design doc on the new image cache architecture, I'd love to ...
7 years, 2 months ago (2013-10-17 02:06:12 UTC) #38
reveman
Thanks for the review. Small design doc for new image cache here: https://docs.google.com/a/chromium.org/document/d/1QmNOMRLFJoLp0s-VkIGu2d-2UUdQmS_rJAGSCdqpKs4/edit?usp=sharing https://codereview.chromium.org/17106004/diff/121001/base/memory/discardable_memory_provider.cc File ...
7 years, 2 months ago (2013-10-19 21:17:03 UTC) #39
willchan no longer on Chromium
https://codereview.chromium.org/17106004/diff/121001/base/memory/discardable_memory_provider.cc File base/memory/discardable_memory_provider.cc (right): https://codereview.chromium.org/17106004/diff/121001/base/memory/discardable_memory_provider.cc#newcode52 base/memory/discardable_memory_provider.cc:52: return Singleton<DiscardableMemoryProvider>::get(); On 2013/10/19 21:17:04, David Reveman wrote: > ...
7 years, 2 months ago (2013-10-21 18:30:26 UTC) #40
willchan no longer on Chromium
https://codereview.chromium.org/17106004/diff/130001/base/memory/discardable_memory_provider.cc File base/memory/discardable_memory_provider.cc (right): https://codereview.chromium.org/17106004/diff/130001/base/memory/discardable_memory_provider.cc#newcode132 base/memory/discardable_memory_provider.cc:132: if (bytes > discardable_memory_limit_) I'm confused. The comment for ...
7 years, 2 months ago (2013-10-21 21:29:11 UTC) #41
reveman
Rebased and addressed review feedback. PTAL. https://codereview.chromium.org/17106004/diff/121001/base/memory/discardable_memory_provider.cc File base/memory/discardable_memory_provider.cc (right): https://codereview.chromium.org/17106004/diff/121001/base/memory/discardable_memory_provider.cc#newcode52 base/memory/discardable_memory_provider.cc:52: return Singleton<DiscardableMemoryProvider>::get(); On ...
7 years, 2 months ago (2013-10-22 00:11:41 UTC) #42
willchan no longer on Chromium
OK, I'm happy with this CL, mod testing feedback from jyasskin. LGTM, but please wait ...
7 years, 1 month ago (2013-10-29 01:44:58 UTC) #43
reveman
+jamesr for webkit/ +reed for skia/ https://codereview.chromium.org/17106004/diff/220001/base/memory/discardable_memory_provider_unittest.cc File base/memory/discardable_memory_provider_unittest.cc (right): https://codereview.chromium.org/17106004/diff/220001/base/memory/discardable_memory_provider_unittest.cc#newcode185 base/memory/discardable_memory_provider_unittest.cc:185: #define DiscardableMemoryProviderPermutions(name, pressure) ...
7 years, 1 month ago (2013-10-29 15:22:22 UTC) #44
willchan no longer on Chromium
NM, you figured it out, and I forgot to add jyasskin :) Go ahead and ...
7 years, 1 month ago (2013-10-29 18:12:05 UTC) #45
jamesr
webkit lgtm (although I think you've already got a stamp for it)
7 years, 1 month ago (2013-10-30 00:29:49 UTC) #46
Tom Hudson
Skia LGTM
7 years, 1 month ago (2013-10-30 14:55:33 UTC) #47
tomhudson
Skia LGTM from the other account.
7 years, 1 month ago (2013-10-30 14:57:15 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/vollick@chromium.org/17106004/690001
7 years, 1 month ago (2013-10-30 14:58:46 UTC) #49
commit-bot: I haz the power
Change committed as 231845
7 years, 1 month ago (2013-10-30 16:33:33 UTC) #50
Philippe
https://codereview.chromium.org/17106004/diff/690001/base/memory/discardable_memory_emulated.cc File base/memory/discardable_memory_emulated.cc (right): https://codereview.chromium.org/17106004/diff/690001/base/memory/discardable_memory_emulated.cc#newcode70 base/memory/discardable_memory_emulated.cc:70: if (memory->Lock() != DISCARDABLE_MEMORY_PURGED) I was playing on Linux ...
7 years, 1 month ago (2013-11-05 12:41:38 UTC) #51
Ian Vollick
On 2013/11/05 12:41:38, Philippe wrote: > https://codereview.chromium.org/17106004/diff/690001/base/memory/discardable_memory_emulated.cc > File base/memory/discardable_memory_emulated.cc (right): > > https://codereview.chromium.org/17106004/diff/690001/base/memory/discardable_memory_emulated.cc#newcode70 > ...
7 years, 1 month ago (2013-11-05 13:16:18 UTC) #52
Philippe
7 years, 1 month ago (2013-11-05 13:27:56 UTC) #53
Message was sent while issue was closed.
On 2013/11/05 13:16:18, Ian Vollick wrote:
> On 2013/11/05 12:41:38, Philippe wrote:
> >
>
https://codereview.chromium.org/17106004/diff/690001/base/memory/discardable_...
> > File base/memory/discardable_memory_emulated.cc (right):
> > 
> >
>
https://codereview.chromium.org/17106004/diff/690001/base/memory/discardable_...
> > base/memory/discardable_memory_emulated.cc:70: if (memory->Lock() !=
> > DISCARDABLE_MEMORY_PURGED)
> > I was playing on Linux with discardable memory (thanks to this CL :)) and
came
> > across this line. Is the use of DISCARDABLE_MEMORY_PURGED here (instead of
> > DISCARDABLE_MEMORY_SUCCESS) intentional?
> 
> Yep, it is intentional, though perhaps in need of a comment. When Acquire
> returns 'PURGED' it means, "yes, I was able to obtain locked memory for you,
but
> it could contain anything." This should be the case when we create a new
> discardable since this is the first time we allocate its memory. It may be the
> case that this will return 'FAILED' (because allocation doesn't succeed), but
it
> should never return 'SUCCESS' on the first acquire.

Great, thanks Ian.

Powered by Google App Engine
This is Rietveld 408576698