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

Side by Side Diff: net/disk_cache/flash/storage.cc

Issue 11316178: Added CacheEntry implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added destructor for Stream struct. Created 8 years 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 unified diff | Download patch
« no previous file with comments | « net/disk_cache/flash/format.h ('k') | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/flash/storage.h" 5 #include "net/disk_cache/flash/storage.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 25 matching lines...) Expand all
36 #endif 36 #endif
37 37
38 return true; 38 return true;
39 } 39 }
40 40
41 Storage::~Storage() { 41 Storage::~Storage() {
42 base::ClosePlatformFile(file_); 42 base::ClosePlatformFile(file_);
43 } 43 }
44 44
45 bool Storage::Read(void* buffer, int32 size, int32 offset) { 45 bool Storage::Read(void* buffer, int32 size, int32 offset) {
46 DCHECK(buffer);
47 DCHECK(offset >= 0 && offset + size <= size_); 46 DCHECK(offset >= 0 && offset + size <= size_);
48 47
49 int rv = base::ReadPlatformFile(file_, offset, static_cast<char*>(buffer), 48 int rv = base::ReadPlatformFile(file_, offset, static_cast<char*>(buffer),
50 size); 49 size);
51 return rv == size; 50 return rv == size;
52 } 51 }
53 52
54 bool Storage::Write(const void* buffer, int32 size, int32 offset) { 53 bool Storage::Write(const void* buffer, int32 size, int32 offset) {
55 DCHECK(buffer);
56 DCHECK(offset >= 0 && offset + size <= size_); 54 DCHECK(offset >= 0 && offset + size <= size_);
57 55
58 int rv = base::WritePlatformFile(file_, offset, 56 int rv = base::WritePlatformFile(file_, offset,
59 static_cast<const char*>(buffer), size); 57 static_cast<const char*>(buffer), size);
60 return rv == size; 58 return rv == size;
61 } 59 }
62 60
63 } // namespace disk_cache 61 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/flash/format.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698