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

Side by Side Diff: net/disk_cache/sparse_control.h

Issue 155590: Disk cache: Add support for having a sparse entry block that... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/rankings.cc ('k') | net/disk_cache/sparse_control.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef NET_DISK_CACHE_SPARSE_CONTROL_H_ 5 #ifndef NET_DISK_CACHE_SPARSE_CONTROL_H_
6 #define NET_DISK_CACHE_SPARSE_CONTROL_H_ 6 #define NET_DISK_CACHE_SPARSE_CONTROL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 int CreateSparseEntry(); 74 int CreateSparseEntry();
75 int OpenSparseEntry(int data_len); 75 int OpenSparseEntry(int data_len);
76 76
77 // Opens and closes a child entry. A child entry is a regular EntryImpl object 77 // Opens and closes a child entry. A child entry is a regular EntryImpl object
78 // with a key derived from the key of the resource to store and the range 78 // with a key derived from the key of the resource to store and the range
79 // stored by that child. 79 // stored by that child.
80 bool OpenChild(); 80 bool OpenChild();
81 void CloseChild(); 81 void CloseChild();
82 std::string GenerateChildKey(); 82 std::string GenerateChildKey();
83 83
84 // Deletes the current child and continues the current operation (open).
85 bool KillChildAndContinue(const std::string& key, bool fatal);
86
87 // Continues the current operation (open) without a current child.
88 bool ContinueWithoutChild(const std::string& key);
89
84 // Returns true if the required child is tracked by the parent entry, i.e. it 90 // Returns true if the required child is tracked by the parent entry, i.e. it
85 // was already created. 91 // was already created.
86 bool ChildPresent(); 92 bool ChildPresent();
87 93
88 // Starts tracking this child. A new child entry was created so we must set 94 // Sets the bit for the current child to the provided |value|. In other words,
89 // the corresponding bit on the bitmap of children. 95 // starts or stops tracking this child.
90 void SetChildBit(); 96 void SetChildBit(bool value);
91 97
92 // Writes to disk the tracking information for this entry. 98 // Writes to disk the tracking information for this entry.
93 void WriteSparseData(); 99 void WriteSparseData();
94 100
95 // Verify that the range to be accessed for the current child is appropriate. 101 // Verify that the range to be accessed for the current child is appropriate.
96 // Returns false if an error is detected or there is no need to perform the 102 // Returns false if an error is detected or there is no need to perform the
97 // current IO operation (for instance if the required range is not stored by 103 // current IO operation (for instance if the required range is not stored by
98 // the child). 104 // the child).
99 bool VerifyRange(); 105 bool VerifyRange();
100 106
101 // Updates the contents bitmap for the current range, based on the result of 107 // Updates the contents bitmap for the current range, based on the result of
102 // the current operation. 108 // the current operation.
103 void UpdateRange(int result); 109 void UpdateRange(int result);
104 110
111 // Returns the number of bytes stored at |block_index|, if its allocation-bit
112 // is off (because it is not completely filled).
113 int PartialBlockLength(int block_index) const;
114
105 // Initializes the sparse info for the current child. 115 // Initializes the sparse info for the current child.
106 void InitChildData(); 116 void InitChildData();
107 117
108 // Iterates through all the children needed to complete the current operation. 118 // Iterates through all the children needed to complete the current operation.
109 void DoChildrenIO(); 119 void DoChildrenIO();
110 120
111 // Performs a single operation with the current child. Returns true when we 121 // Performs a single operation with the current child. Returns true when we
112 // should move on to the next child and false when we should interrupt our 122 // should move on to the next child and false when we should interrupt our
113 // work. 123 // work.
114 bool DoChildIO(); 124 bool DoChildIO();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 int child_offset_; // Offset to use for the current child. 156 int child_offset_; // Offset to use for the current child.
147 int child_len_; // Bytes to read or write for this child. 157 int child_len_; // Bytes to read or write for this child.
148 int result_; 158 int result_;
149 159
150 DISALLOW_COPY_AND_ASSIGN(SparseControl); 160 DISALLOW_COPY_AND_ASSIGN(SparseControl);
151 }; 161 };
152 162
153 } // namespace disk_cache 163 } // namespace disk_cache
154 164
155 #endif // NET_DISK_CACHE_SPARSE_CONTROL_H_ 165 #endif // NET_DISK_CACHE_SPARSE_CONTROL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/rankings.cc ('k') | net/disk_cache/sparse_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698