Skip to content

Commit 70af77e

Browse files
committed
[MERGE #5230 @boingoing] Make SimpleDataCacheWrapper a finalizable object
Merge pull request #5230 from boingoing:finalizable_simpledatacache
2 parents bc2e55a + c10b625 commit 70af77e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Runtime/Language/SimpleDataCacheWrapper.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace Js
3030
// as many times as necessary to write the data into the cache.
3131
// To read a block of data, call SeekReadStreamToBlock (optionally fetching the size of this
3232
// block) and then call Read or ReadArray as necessary to read the data from the cache.
33-
class SimpleDataCacheWrapper
33+
class SimpleDataCacheWrapper : public FinalizableObject
3434
{
3535
public:
3636
enum BlockType : byte
@@ -43,9 +43,6 @@ namespace Js
4343
// Does an AddRef on dataCache
4444
SimpleDataCacheWrapper(IActiveScriptDataCache* dataCache);
4545

46-
// Does Release on dataCache
47-
~SimpleDataCacheWrapper() { this->Close(); }
48-
4946
// Begin to write a block into the cache.
5047
// Note: Must be called before writing bytes into the block as the block header is
5148
// used to lookup the block when reading.
@@ -143,6 +140,10 @@ namespace Js
143140
return hr;
144141
}
145142

143+
virtual void Dispose(bool isShutdown) override { Close(); }
144+
virtual void Finalize(bool isShutdown) override { }
145+
virtual void Mark(Recycler * recycler) override { }
146+
146147
private:
147148
const static uint MAX_BLOCKS_ALLOWED = 0xff;
148149

0 commit comments

Comments
 (0)