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

Issue 84783002: SkDiscardableMemory::Factory class (Closed)

Created:
7 years ago by hal.canary
Modified:
7 years ago
Reviewers:
scroggo, reed1
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

SkDiscardableMemory::Factory class Implementation in SkImageCache which turns all SkImageCache subclasses into DMFactorys. Modify SkDiscardablePixelRef to use either a DMFactory or a the default SkDiscardableMemory::Create() function. Remove SkLazyPixelRef, since everything it can do can be done by either SkCachingPixleRef or a SkDiscardablePixelRef. Move LAZY_CACHE_STATS from SkLazyPixelRef to SkDiscardablePixelRef. Move SkDiscardableMemory.h to include/core, since Chrome already is relying on it. SkBitmapFactory uses SkDiscardablePixelRef+DMFactory instead of SkLazyPixelRef. All tests which directly referenced SkLazyPixelRef no longer do that. BUG=

Patch Set 1 #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+244 lines, -581 lines) Patch
M gyp/core.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M gyp/core.gypi View 1 chunk +2 lines, -2 lines 0 comments Download
A + include/core/SkDiscardableMemory.h View 3 chunks +12 lines, -1 line 0 comments Download
M include/lazy/SkImageCache.h View 2 chunks +7 lines, -5 lines 1 comment Download
D src/core/SkDiscardableMemory.h View 1 chunk +0 lines, -54 lines 0 comments Download
M src/lazy/SkBitmapFactory.cpp View 2 chunks +56 lines, -18 lines 1 comment Download
M src/lazy/SkDiscardablePixelRef.h View 3 chunks +28 lines, -9 lines 1 comment Download
M src/lazy/SkDiscardablePixelRef.cpp View 3 chunks +38 lines, -9 lines 0 comments Download
A src/lazy/SkImageCache.cpp View 1 chunk +83 lines, -0 lines 3 comments Download
D src/lazy/SkLazyPixelRef.h View 1 chunk +0 lines, -96 lines 0 comments Download
D src/lazy/SkLazyPixelRef.cpp View 1 chunk +0 lines, -311 lines 0 comments Download
M tests/BitmapFactoryTest.cpp View 2 chunks +0 lines, -13 lines 0 comments Download
M tests/CachedDecodingPixelRefTest.cpp View 6 chunks +3 lines, -52 lines 0 comments Download
M tests/DrawBitmapRectTest.cpp View 2 chunks +10 lines, -7 lines 1 comment Download
M tools/bench_pictures_main.cpp View 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
hal.canary
244 insertions, 527 deletions This is an alternative to 83663006 that removes SkLazyPixelRef instead of ...
7 years ago (2013-11-24 21:12:45 UTC) #1
scroggo
7 years ago (2013-12-02 19:00:08 UTC) #2
Can you add to the change description what the goal is?

https://codereview.chromium.org/84783002/diff/1/include/lazy/SkImageCache.h
File include/lazy/SkImageCache.h (right):

https://codereview.chromium.org/84783002/diff/1/include/lazy/SkImageCache.h#n...
include/lazy/SkImageCache.h:23: virtual SkDiscardableMemory* create(size_t
bytes) SK_OVERRIDE;
Need this be virtual? Can you imagine a different implementation for a subclass?

It also seems like it doesn't need to be on this class, since it only uses
public functions from this class.

Can you add comments?

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkBitmapFactory.cpp
File src/lazy/SkBitmapFactory.cpp (right):

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkBitmapFactory.cpp#...
src/lazy/SkBitmapFactory.cpp:101: // selector reutuns NULL, that is taken as an
instruction to use
returns*

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkDiscardablePixelRef.h
File src/lazy/SkDiscardablePixelRef.h (right):

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkDiscardablePixelRe...
src/lazy/SkDiscardablePixelRef.h:40: SkDiscardableMemory::Factory* factory =
NULL);
Can you add a comment explaining how the factory is used?

Please include in the comment whether Install calls ref().

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkImageCache.cpp
File src/lazy/SkImageCache.cpp (right):

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkImageCache.cpp#new...
src/lazy/SkImageCache.cpp:13: static SkDiscardableMemory * create(SkImageCache*
cache, size_t size);
SkDiscardableMemory* create

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkImageCache.cpp#new...
src/lazy/SkImageCache.cpp:25: SkDiscardableMemory *
ImageCacheBackedDM::create(SkImageCache* cache,
SkDiscardableMemory* ImageCacheBackedDM...

https://codereview.chromium.org/84783002/diff/1/src/lazy/SkImageCache.cpp#new...
src/lazy/SkImageCache.cpp:39: : fCache(cache), fId(id), fPtr(ptr) {
These should be on their own line:

: fCache(cache)
, fId(id)
, fPtr(ptr) {

The brace could go on the next line (the style guide has not been updated to
reflect that, but I think we're leaning towards changing it to place the brace
on the next line).

https://codereview.chromium.org/84783002/diff/1/tests/DrawBitmapRectTest.cpp
File tests/DrawBitmapRectTest.cpp (right):

https://codereview.chromium.org/84783002/diff/1/tests/DrawBitmapRectTest.cpp#...
tests/DrawBitmapRectTest.cpp:25: info->fColorType = kPMColor_SkColorType;
Is this a separate bug?

Powered by Google App Engine
This is Rietveld 408576698