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

Unified Diff: net/disk_cache/mapped_file_posix.cc

Issue 121643003: Reorganize net/disk_cache into backend specific directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ios breakage Created 6 years, 10 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 | « net/disk_cache/mapped_file_avoid_mmap_posix.cc ('k') | net/disk_cache/mapped_file_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/mapped_file_posix.cc
diff --git a/net/disk_cache/mapped_file_posix.cc b/net/disk_cache/mapped_file_posix.cc
deleted file mode 100644
index 576d02afaeaab5b382c67e43064557242d37537a..0000000000000000000000000000000000000000
--- 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
« no previous file with comments | « net/disk_cache/mapped_file_avoid_mmap_posix.cc ('k') | net/disk_cache/mapped_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698