OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SIMPLE_SIMPLE_ENTRY_OPERATION_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_OPERATION_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_OPERATION_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_OPERATION_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class SimpleEntryOperation { | 24 class SimpleEntryOperation { |
25 public: | 25 public: |
26 typedef net::CompletionCallback CompletionCallback; | 26 typedef net::CompletionCallback CompletionCallback; |
27 | 27 |
28 enum EntryOperationType { | 28 enum EntryOperationType { |
29 TYPE_OPEN = 0, | 29 TYPE_OPEN = 0, |
30 TYPE_CREATE = 1, | 30 TYPE_CREATE = 1, |
31 TYPE_CLOSE = 2, | 31 TYPE_CLOSE = 2, |
32 TYPE_READ = 3, | 32 TYPE_READ = 3, |
33 TYPE_WRITE = 4, | 33 TYPE_WRITE = 4, |
| 34 TYPE_DOOM = 5, |
34 }; | 35 }; |
35 | 36 |
36 SimpleEntryOperation(const SimpleEntryOperation& other); | 37 SimpleEntryOperation(const SimpleEntryOperation& other); |
37 ~SimpleEntryOperation(); | 38 ~SimpleEntryOperation(); |
38 | 39 |
39 static SimpleEntryOperation OpenOperation(SimpleEntryImpl* entry, | 40 static SimpleEntryOperation OpenOperation(SimpleEntryImpl* entry, |
40 bool have_index, | 41 bool have_index, |
41 const CompletionCallback& callback, | 42 const CompletionCallback& callback, |
42 Entry** out_entry); | 43 Entry** out_entry); |
43 static SimpleEntryOperation CreateOperation( | 44 static SimpleEntryOperation CreateOperation( |
(...skipping 12 matching lines...) Expand all Loading... |
56 static SimpleEntryOperation WriteOperation( | 57 static SimpleEntryOperation WriteOperation( |
57 SimpleEntryImpl* entry, | 58 SimpleEntryImpl* entry, |
58 int index, | 59 int index, |
59 int offset, | 60 int offset, |
60 int length, | 61 int length, |
61 net::IOBuffer* buf, | 62 net::IOBuffer* buf, |
62 bool truncate, | 63 bool truncate, |
63 bool optimistic, | 64 bool optimistic, |
64 const CompletionCallback& callback); | 65 const CompletionCallback& callback); |
65 | 66 |
| 67 static SimpleEntryOperation DoomOperation( |
| 68 SimpleEntryImpl* entry, |
| 69 const CompletionCallback& callback); |
| 70 |
66 bool ConflictsWith(const SimpleEntryOperation& other_op) const; | 71 bool ConflictsWith(const SimpleEntryOperation& other_op) const; |
67 // Releases all references. After calling this operation, SimpleEntryOperation | 72 // Releases all references. After calling this operation, SimpleEntryOperation |
68 // will only hold POD members. | 73 // will only hold POD members. |
69 void ReleaseReferences(); | 74 void ReleaseReferences(); |
70 | 75 |
71 EntryOperationType type() const { | 76 EntryOperationType type() const { |
72 return static_cast<EntryOperationType>(type_); | 77 return static_cast<EntryOperationType>(type_); |
73 } | 78 } |
74 const CompletionCallback& callback() const { return callback_; } | 79 const CompletionCallback& callback() const { return callback_; } |
75 Entry** out_entry() { return out_entry_; } | 80 Entry** out_entry() { return out_entry_; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Used only in write operations. | 121 // Used only in write operations. |
117 const unsigned int truncate_ : 1; /* 7 */ | 122 const unsigned int truncate_ : 1; /* 7 */ |
118 const unsigned int optimistic_ : 1; /* 8 */ | 123 const unsigned int optimistic_ : 1; /* 8 */ |
119 // Used only in SimpleCache.ReadIsParallelizable histogram. | 124 // Used only in SimpleCache.ReadIsParallelizable histogram. |
120 const unsigned int alone_in_queue_ : 1; /* 9 */ | 125 const unsigned int alone_in_queue_ : 1; /* 9 */ |
121 }; | 126 }; |
122 | 127 |
123 } // namespace disk_cache | 128 } // namespace disk_cache |
124 | 129 |
125 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_OPERATION_H_ | 130 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_OPERATION_H_ |
OLD | NEW |