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

Unified Diff: net/disk_cache/flash/cache_entry.h

Issue 11316178: Added CacheEntry implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moved insync initialization to constructor. Created 8 years, 1 month 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 | « no previous file | net/disk_cache/flash/cache_entry.cc » ('j') | net/disk_cache/flash/cache_entry.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/flash/cache_entry.h
diff --git a/net/disk_cache/flash/cache_entry.h b/net/disk_cache/flash/cache_entry.h
new file mode 100644
index 0000000000000000000000000000000000000000..1075c7c01c893a1accd8c5d8862a5459dbd2c1f8
--- /dev/null
+++ b/net/disk_cache/flash/cache_entry.h
@@ -0,0 +1,66 @@
+// 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.
+
+#ifndef NET_DISK_CACHE_FLASH_LOG_ENTRY_H_
+#define NET_DISK_CACHE_FLASH_LOG_ENTRY_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "net/base/net_export.h"
+#include "net/disk_cache/flash/format.h"
+
+namespace net {
+class IOBuffer;
+};
+
+namespace disk_cache {
+
+class LogStructuredStore;
+
+class NET_EXPORT_PRIVATE CacheEntry {
+ public:
+ explicit CacheEntry(LogStructuredStore* store);
+ CacheEntry(LogStructuredStore* store, int32 id);
+ ~CacheEntry();
+
+ bool Init();
+ bool Close();
+
+ int32 id() const;
+ int32 GetDataSize(int index) const;
+
+ int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len);
+ int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len);
+
+ private:
+ bool OnDisk() const;
+ bool ValidStream(int stream_index) const;
+ int32 Size() const;
+ bool Save();
+ bool LazyRead(int index);
+
+ LogStructuredStore* store_;
+ int32 id_;
+
+ struct Stream {
rvargas (doing something else) 2012/11/28 03:12:56 types go before methods
agayev 2012/11/29 16:14:43 Done.
+ Stream() : offset(0), insync(false) {}
rvargas (doing something else) 2012/11/28 03:12:56 cannot be inline
agayev 2012/11/29 16:14:43 Done.
+ int offset;
+ std::vector<char> data;
+ bool insync;
rvargas (doing something else) 2012/11/28 03:12:56 insync?
agayev 2012/11/29 16:14:43 Means in sync with the store.
rvargas (doing something else) 2012/11/29 20:32:36 Then, at the very least it should be in_sync (but
+ };
+
+ Stream streams_[kFlashCacheEntryNumStreams];
+
+ bool init_;
+ bool closed_;
+ bool modified_;
+
+ DISALLOW_COPY_AND_ASSIGN(CacheEntry);
+};
+
+} // namespace disk_cache
+
+#endif // NET_DISK_CACHE_FLASH_LOG_ENTRY_H_
« no previous file with comments | « no previous file | net/disk_cache/flash/cache_entry.cc » ('j') | net/disk_cache/flash/cache_entry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698