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

Side by Side 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, 8 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_DISK_CACHE_FLASH_ENTRY_IMPL_H_
6 #define NET_DISK_CACHE_FLASH_ENTRY_IMPL_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "net/base/net_export.h"
13 #include "net/disk_cache/disk_cache.h"
14 #include "net/disk_cache/flash/internal_entry.h"
15
16 namespace base {
17
18 class MessageLoopProxy;
19
20 } // namespace base
21
22 namespace disk_cache {
23
24 class InternalEntry;
25 class IOBuffer;
26 class LogStore;
27
28 class NET_EXPORT_PRIVATE FlashEntryImpl
29 : public Entry,
30 public base::RefCounted<FlashEntryImpl> {
31 friend class base::RefCounted<FlashEntryImpl>;
32 public:
33 FlashEntryImpl(const std::string& key,
34 LogStore* store,
35 base::MessageLoopProxy* cache_thread);
36 FlashEntryImpl(int32 id,
37 LogStore* store,
38 base::MessageLoopProxy* cache_thread);
39
40 int Init(const CompletionCallback& callback);
41
42 // disk_cache::Entry interface.
43 virtual void Doom() OVERRIDE;
44 virtual void Close() OVERRIDE;
45 virtual std::string GetKey() const OVERRIDE;
46 virtual base::Time GetLastUsed() const OVERRIDE;
47 virtual base::Time GetLastModified() const OVERRIDE;
48 virtual int32 GetDataSize(int index) const OVERRIDE;
49 virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len,
50 const CompletionCallback& callback) OVERRIDE;
51 virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len,
52 const CompletionCallback& callback,
53 bool truncate) OVERRIDE;
54 virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len,
55 const CompletionCallback& callback) OVERRIDE;
56 virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len,
57 const CompletionCallback& callback) OVERRIDE;
58 virtual int GetAvailableRange(int64 offset, int len, int64* start,
59 const CompletionCallback& callback) OVERRIDE;
60 virtual bool CouldBeSparse() const OVERRIDE;
61 virtual void CancelSparseIO() OVERRIDE;
62 virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE;
63
64 private:
65 void OnInitComplete(scoped_ptr<KeyAndStreamSizes> key_and_stream_sizes);
66 virtual ~FlashEntryImpl();
67
68 bool init_;
69 std::string key_;
70 int stream_sizes_[kFlashLogStoreEntryNumStreams];
71 CompletionCallback callback_;
72
73 scoped_refptr<InternalEntry> new_internal_entry_;
74 scoped_refptr<InternalEntry> old_internal_entry_;
75 scoped_refptr<base::MessageLoopProxy> cache_thread_;
76
77 DISALLOW_COPY_AND_ASSIGN(FlashEntryImpl);
78 };
79
80 } // namespace disk_cache
81
82 #endif // NET_DISK_CACHE_FLASH_ENTRY_IMPL_H_
OLDNEW
« 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