summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/mapped_file_posix.cc
diff options
context:
space:
mode:
authorgavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 16:35:28 +0000
committergavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 16:35:28 +0000
commitc2c5cfc4250c95b73539f28c9f435416c8cae240 (patch)
treef16752986b98155982ed1d95e7e82c466363fe67 /net/disk_cache/mapped_file_posix.cc
parentc7c1abc7b7c7ca539de99f0e73d067d80444e2b6 (diff)
downloadchromium_src-c2c5cfc4250c95b73539f28c9f435416c8cae240.zip
chromium_src-c2c5cfc4250c95b73539f28c9f435416c8cae240.tar.gz
chromium_src-c2c5cfc4250c95b73539f28c9f435416c8cae240.tar.bz2
Reland re-organization of net/disk_cache/
Originally this landed from https://codereview.chromium.org/121643003/ , but reverted due to an iOS build break. BUG=331062 TBR=mmenke@chromium.org,rvargas@chromium.org Review URL: https://codereview.chromium.org/185003007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/mapped_file_posix.cc')
-rw-r--r--net/disk_cache/mapped_file_posix.cc54
1 files changed, 0 insertions, 54 deletions
diff --git a/net/disk_cache/mapped_file_posix.cc b/net/disk_cache/mapped_file_posix.cc
deleted file mode 100644
index 576d02a..0000000
--- a/net/disk_cache/mapped_file_posix.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/disk_cache/mapped_file.h"
-
-#include <errno.h>
-#include <sys/mman.h>
-
-#include "base/files/file_path.h"
-#include "base/logging.h"
-#include "net/disk_cache/disk_cache.h"
-
-namespace disk_cache {
-
-void* MappedFile::Init(const base::FilePath& name, size_t size) {
- DCHECK(!init_);
- if (init_ || !File::Init(name))
- return NULL;
-
- size_t temp_len = size ? size : 4096;
- if (!size)
- size = GetLength();
-
- buffer_ = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
- platform_file(), 0);
- init_ = true;
- view_size_ = size;
- DCHECK(reinterpret_cast<intptr_t>(buffer_) != -1);
- if (reinterpret_cast<intptr_t>(buffer_) == -1)
- buffer_ = 0;
-
- // Make sure we detect hardware failures reading the headers.
- scoped_ptr<char[]> temp(new char[temp_len]);
- if (!Read(temp.get(), temp_len, 0))
- return NULL;
-
- return buffer_;
-}
-
-void MappedFile::Flush() {
-}
-
-MappedFile::~MappedFile() {
- if (!init_)
- return;
-
- if (buffer_) {
- int ret = munmap(buffer_, view_size_);
- DCHECK_EQ(0, ret);
- }
-}
-
-} // namespace disk_cache