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

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

Issue 12847012: Adding disk_cache::Entry implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implemented Init. Created 7 years, 9 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 | « no previous file | net/disk_cache/flash/flash_entry_impl.cc » ('j') | net/disk_cache/flash/flash_entry_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/flash/flash_entry_impl.h
diff --git a/net/disk_cache/flash/flash_entry_impl.h b/net/disk_cache/flash/flash_entry_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..efc373153d0e5a7e8492d4df1cd867a7c1d58e01
--- /dev/null
+++ b/net/disk_cache/flash/flash_entry_impl.h
@@ -0,0 +1,82 @@
+// 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_ENTRY_IMPL_H_
+#define NET_DISK_CACHE_FLASH_ENTRY_IMPL_H_
+
+#include <string>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "net/base/net_export.h"
+#include "net/disk_cache/disk_cache.h"
+#include "net/disk_cache/flash/internal_entry.h"
+
+namespace base {
+
+class MessageLoopProxy;
+
+} // namespace base
+
+namespace disk_cache {
+
+class InternalEntry;
+class IOBuffer;
+class LogStore;
+
+class NET_EXPORT_PRIVATE FlashEntryImpl
+ : public Entry,
+ public base::RefCounted<FlashEntryImpl> {
+ friend class base::RefCounted<FlashEntryImpl>;
+ public:
+ FlashEntryImpl(const std::string& key,
+ LogStore* store,
+ base::MessageLoopProxy* cache_thread);
+ FlashEntryImpl(int32 id,
+ LogStore* store,
+ base::MessageLoopProxy* cache_thread);
+
+ int Init(const CompletionCallback& callback);
+
+ // disk_cache::Entry interface.
+ virtual void Doom() OVERRIDE;
+ virtual void Close() OVERRIDE;
+ virtual std::string GetKey() const OVERRIDE;
+ virtual base::Time GetLastUsed() const OVERRIDE;
+ virtual base::Time GetLastModified() const OVERRIDE;
+ virtual int32 GetDataSize(int index) const OVERRIDE;
+ virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback,
+ bool truncate) OVERRIDE;
+ virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int GetAvailableRange(int64 offset, int len, int64* start,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual bool CouldBeSparse() const OVERRIDE;
+ virtual void CancelSparseIO() OVERRIDE;
+ virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE;
+
+ private:
+ void OnInitComplete(scoped_ptr<KeyAndStreamSizes> key_and_stream_sizes);
+ virtual ~FlashEntryImpl();
+
+ bool init_;
+ std::string key_;
+ int stream_sizes_[kFlashLogStoreEntryNumStreams];
+ CompletionCallback callback_;
+
+ scoped_refptr<InternalEntry> new_internal_entry_;
+ scoped_refptr<InternalEntry> old_internal_entry_;
+ scoped_refptr<base::MessageLoopProxy> cache_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(FlashEntryImpl);
+};
+
+} // namespace disk_cache
+
+#endif // NET_DISK_CACHE_FLASH_ENTRY_IMPL_H_
« no previous file with comments | « no previous file | net/disk_cache/flash/flash_entry_impl.cc » ('j') | net/disk_cache/flash/flash_entry_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698