summaryrefslogtreecommitdiffstats
path: root/include/utils
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-02-23 15:43:35 +0000
committerNarayan Kamath <narayan@google.com>2015-02-23 15:49:43 +0000
commit6832a7a4e04c84192f0bafc6ac990fc79cd13882 (patch)
treee8c0940ae4a25e96db0ad84985991731f2b1b8f4 /include/utils
parentf1ac6917da172dd3e6829bac41fcbf23e96da079 (diff)
downloadsystem_core-6832a7a4e04c84192f0bafc6ac990fc79cd13882.zip
system_core-6832a7a4e04c84192f0bafc6ac990fc79cd13882.tar.gz
system_core-6832a7a4e04c84192f0bafc6ac990fc79cd13882.tar.bz2
Remove useless refCounting from FileMap.
Nobody ever called acquire() so release() was always equivalent to delete. Just use delete instead so that people can use unique_ptr directly (or shared_ptr if they really want refcounts). Change-Id: I9e3ad5e0f6a4fcc4e02e5a2ff7ef9514fe234415
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/FileMap.h18
1 files changed, 2 insertions, 16 deletions
diff --git a/include/utils/FileMap.h b/include/utils/FileMap.h
index 6c0aa52..f70fc92 100644
--- a/include/utils/FileMap.h
+++ b/include/utils/FileMap.h
@@ -63,6 +63,8 @@ public:
bool create(const char* origFileName, int fd,
off64_t offset, size_t length, bool readOnly);
+ ~FileMap(void);
+
/*
* Return the name of the file this map came from, if known.
*/
@@ -84,19 +86,6 @@ public:
off64_t getDataOffset(void) const { return mDataOffset; }
/*
- * Get a "copy" of the object.
- */
- FileMap* acquire(void) { mRefCount++; return this; }
-
- /*
- * Call this when mapping is no longer needed.
- */
- void release(void) {
- if (--mRefCount <= 0)
- delete this;
- }
-
- /*
* This maps directly to madvise() values, but allows us to avoid
* including <sys/mman.h> everywhere.
*/
@@ -112,15 +101,12 @@ public:
int advise(MapAdvice advice);
protected:
- // don't delete objects; call release()
- ~FileMap(void);
private:
// these are not implemented
FileMap(const FileMap& src);
const FileMap& operator=(const FileMap& src);
- int mRefCount; // reference count
char* mFileName; // original file name, if known
void* mBasePtr; // base of mmap area; page aligned
size_t mBaseLength; // length, measured from "mBasePtr"