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

Unified Diff: skia/images/SkMMapStream.cpp

Issue 113827: Remove the remainder of the skia source code from the Chromium repo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/images/SkImageRef_GlobalPool.cpp ('k') | skia/images/SkMovie.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/images/SkMMapStream.cpp
===================================================================
--- skia/images/SkMMapStream.cpp (revision 16859)
+++ skia/images/SkMMapStream.cpp (working copy)
@@ -1,63 +0,0 @@
-#include "SkMMapStream.h"
-
-#include <unistd.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <errno.h>
-
-SkMMAPStream::SkMMAPStream(const char filename[])
-{
- fFildes = -1; // initialize to failure case
-
- int fildes = open(filename, O_RDONLY);
- if (fildes < 0)
- {
- SkDEBUGF(("---- failed to open(%s) for mmap stream error=%d\n", filename, errno));
- return;
- }
-
- off_t size = lseek(fildes, 0, SEEK_END); // find the file size
- if (size == -1)
- {
- SkDEBUGF(("---- failed to lseek(%s) for mmap stream error=%d\n", filename, errno));
- close(fildes);
- return;
- }
- (void)lseek(fildes, 0, SEEK_SET); // restore file offset to beginning
-
- void* addr = mmap(NULL, size, PROT_READ, MAP_SHARED, fildes, 0);
- if (MAP_FAILED == addr)
- {
- SkDEBUGF(("---- failed to mmap(%s) for mmap stream error=%d\n", filename, errno));
- close(fildes);
- return;
- }
-
- this->INHERITED::setMemory(addr, size);
-
- fFildes = fildes;
- fAddr = addr;
- fSize = size;
-}
-
-SkMMAPStream::~SkMMAPStream()
-{
- this->closeMMap();
-}
-
-void SkMMAPStream::setMemory(const void* data, size_t length)
-{
- this->closeMMap();
- this->INHERITED::setMemory(data, length);
-}
-
-void SkMMAPStream::closeMMap()
-{
- if (fFildes >= 0)
- {
- munmap(fAddr, fSize);
- close(fFildes);
- fFildes = -1;
- }
-}
-
« no previous file with comments | « skia/images/SkImageRef_GlobalPool.cpp ('k') | skia/images/SkMovie.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698