Chromium Code Reviews| 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_SYNCHRONOUS_ENTRY_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/disk_cache/simple/simple_disk_format.h" | 17 #include "net/disk_cache/simple/simple_disk_format.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 class IOBuffer; | 24 class IOBuffer; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace disk_cache { | 27 namespace disk_cache { |
| 28 | 28 |
| 29 // Worker thread interface to the very simple cache. This interface is not | 29 // Worker thread interface to the very simple cache. This interface is not |
| 30 // thread safe, and callers must insure that it is only ever accessed from | 30 // thread safe, and callers must insure that it is only ever accessed from |
|
pasko-google - do not use
2013/04/08 09:25:13
s/insure/ensure/
??
gavinp
2013/04/08 11:26:03
Both words are valid, see http://www.ahdictionary.
| |
| 31 // a single thread between synchronization points. | 31 // a single thread between synchronization points. |
| 32 class SimpleSynchronousEntry { | 32 class SimpleSynchronousEntry { |
| 33 public: | 33 public: |
| 34 typedef base::Callback<void(SimpleSynchronousEntry*)> | 34 // Callback type for the completion of creation of SimpleSynchronousEntry |
| 35 // objects, for instance after OpenEntry() or CreateEntry(). |new_entry| is | |
| 36 // the newly created SimpleSynchronousEntry, constructed on the worker pool | |
| 37 // thread. |new_entry| == NULL in the case of error. | |
| 38 typedef base::Callback<void(SimpleSynchronousEntry* /* new_entry */)> | |
| 35 SynchronousCreationCallback; | 39 SynchronousCreationCallback; |
| 36 | 40 |
| 37 typedef base::Callback<void(int)> | 41 // Callback type for IO operations on an entry not requiring special callback |
| 38 SynchronousOperationCallback; | 42 // arguments (e.g. Write). |result| is a net::Error result code. |
| 43 typedef base::Callback<void(int /* result */)> SynchronousOperationCallback; | |
| 39 | 44 |
| 40 static void OpenEntry( | 45 static void OpenEntry( |
| 41 const base::FilePath& path, | 46 const base::FilePath& path, |
| 42 const std::string& key, | 47 const std::string& key, |
| 43 const scoped_refptr<base::TaskRunner>& callback_runner, | 48 const scoped_refptr<base::TaskRunner>& callback_runner, |
| 44 const SynchronousCreationCallback& callback); | 49 const SynchronousCreationCallback& callback); |
| 45 | 50 |
| 46 static void CreateEntry( | 51 static void CreateEntry( |
| 47 const base::FilePath& path, | 52 const base::FilePath& path, |
| 48 const std::string& key, | 53 const std::string& key, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 base::Time last_used_; | 108 base::Time last_used_; |
| 104 base::Time last_modified_; | 109 base::Time last_modified_; |
| 105 int32 data_size_[kSimpleEntryFileCount]; | 110 int32 data_size_[kSimpleEntryFileCount]; |
| 106 | 111 |
| 107 base::PlatformFile files_[kSimpleEntryFileCount]; | 112 base::PlatformFile files_[kSimpleEntryFileCount]; |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 } // namespace disk_cache | 115 } // namespace disk_cache |
| 111 | 116 |
| 112 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 117 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
| OLD | NEW |