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

Unified Diff: net/disk_cache/flash/storage.cc

Issue 182093002: Remove the flash specific disk cache backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/flash/storage.h ('k') | net/disk_cache/flash/storage_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/flash/storage.cc
diff --git a/net/disk_cache/flash/storage.cc b/net/disk_cache/flash/storage.cc
deleted file mode 100644
index 9359b66ee6ad810af9017566f078fe7063cdf2c9..0000000000000000000000000000000000000000
--- a/net/disk_cache/flash/storage.cc
+++ /dev/null
@@ -1,59 +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/flash/storage.h"
-
-#include <fcntl.h>
-
-#include "base/logging.h"
-#include "net/base/net_errors.h"
-#include "net/disk_cache/flash/format.h"
-
-namespace disk_cache {
-
-Storage::Storage(const base::FilePath& path,
- int32 size)
- : path_(path), size_(size) {
- COMPILE_ASSERT(kFlashPageSize % 2 == 0, invalid_page_size);
- COMPILE_ASSERT(kFlashBlockSize % kFlashPageSize == 0, invalid_block_size);
- DCHECK(size_ % kFlashBlockSize == 0);
-}
-
-bool Storage::Init() {
- int flags = base::File::FLAG_READ |
- base::File::FLAG_WRITE |
- base::File::FLAG_OPEN_ALWAYS;
-
- file_.Initialize(path_, flags);
- if (!file_.IsValid())
- return false;
-
- // TODO(agayev): if file already exists, do some validation and return either
- // true or false based on the result.
-
-#if defined(OS_LINUX)
- fallocate(file_.GetPlatformFile(), 0, 0, size_);
-#endif
-
- return true;
-}
-
-Storage::~Storage() {
-}
-
-bool Storage::Read(void* buffer, int32 size, int32 offset) {
- DCHECK(offset >= 0 && offset + size <= size_);
-
- int rv = file_.Read(offset, static_cast<char*>(buffer), size);
- return rv == size;
-}
-
-bool Storage::Write(const void* buffer, int32 size, int32 offset) {
- DCHECK(offset >= 0 && offset + size <= size_);
-
- int rv = file_.Write(offset, static_cast<const char*>(buffer), size);
- return rv == size;
-}
-
-} // namespace disk_cache
« no previous file with comments | « net/disk_cache/flash/storage.h ('k') | net/disk_cache/flash/storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698