| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "net/base/cache_type.h" | 17 #include "net/base/cache_type.h" |
| 18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
| 19 #include "net/disk_cache/disk_cache.h" | 19 #include "net/disk_cache/disk_cache.h" |
| 20 #include "net/disk_cache/simple/simple_entry_format.h" | 20 #include "net/disk_cache/simple/simple_entry_format.h" |
| 21 #include "net/disk_cache/simple/simple_entry_operation.h" | 21 #include "net/disk_cache/simple/simple_entry_operation.h" |
| 22 #include "net/log/net_log.h" | 22 #include "net/log/net_log.h" |
| 23 #include "net/log/net_log_event_type.h" |
| 23 | 24 |
| 24 namespace base { | 25 namespace base { |
| 25 class TaskRunner; | 26 class TaskRunner; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace net { | 29 namespace net { |
| 29 class GrowableIOBuffer; | 30 class GrowableIOBuffer; |
| 30 class IOBuffer; | 31 class IOBuffer; |
| 31 } | 32 } |
| 32 | 33 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 220 |
| 220 // Called after a SimpleSynchronousEntry has completed CreateEntry() or | 221 // Called after a SimpleSynchronousEntry has completed CreateEntry() or |
| 221 // OpenEntry(). If |in_sync_entry| is non-NULL, creation is successful and we | 222 // OpenEntry(). If |in_sync_entry| is non-NULL, creation is successful and we |
| 222 // can return |this| SimpleEntryImpl to |*out_entry|. Runs | 223 // can return |this| SimpleEntryImpl to |*out_entry|. Runs |
| 223 // |completion_callback|. | 224 // |completion_callback|. |
| 224 void CreationOperationComplete( | 225 void CreationOperationComplete( |
| 225 const CompletionCallback& completion_callback, | 226 const CompletionCallback& completion_callback, |
| 226 const base::TimeTicks& start_time, | 227 const base::TimeTicks& start_time, |
| 227 std::unique_ptr<SimpleEntryCreationResults> in_results, | 228 std::unique_ptr<SimpleEntryCreationResults> in_results, |
| 228 Entry** out_entry, | 229 Entry** out_entry, |
| 229 net::NetLog::EventType end_event_type); | 230 net::NetLogEventType end_event_type); |
| 230 | 231 |
| 231 // Called after we've closed and written the EOF record to our entry. Until | 232 // Called after we've closed and written the EOF record to our entry. Until |
| 232 // this point it hasn't been safe to OpenEntry() the same entry, but from this | 233 // this point it hasn't been safe to OpenEntry() the same entry, but from this |
| 233 // point it is. | 234 // point it is. |
| 234 void CloseOperationComplete(); | 235 void CloseOperationComplete(); |
| 235 | 236 |
| 236 // Internal utility method used by other completion methods. Calls | 237 // Internal utility method used by other completion methods. Calls |
| 237 // |completion_callback| after updating state and dooming on errors. | 238 // |completion_callback| after updating state and dooming on errors. |
| 238 void EntryOperationComplete(const CompletionCallback& completion_callback, | 239 void EntryOperationComplete(const CompletionCallback& completion_callback, |
| 239 const SimpleEntryStat& entry_stat, | 240 const SimpleEntryStat& entry_stat, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // 1 on disk, to reduce the number of file descriptors and save disk space. | 381 // 1 on disk, to reduce the number of file descriptors and save disk space. |
| 381 // This strategy allows stream 1 to change size easily. Since stream 0 is only | 382 // This strategy allows stream 1 to change size easily. Since stream 0 is only |
| 382 // used to write HTTP headers, the memory consumption of keeping it in memory | 383 // used to write HTTP headers, the memory consumption of keeping it in memory |
| 383 // is acceptable. | 384 // is acceptable. |
| 384 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; | 385 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; |
| 385 }; | 386 }; |
| 386 | 387 |
| 387 } // namespace disk_cache | 388 } // namespace disk_cache |
| 388 | 389 |
| 389 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 390 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| OLD | NEW |