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

Side by Side Diff: net/disk_cache/simple/simple_synchronous_entry.h

Issue 12226095: Make synchronous methods on disk_cache::SimpleEntryImpl() reentrant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: on top of trunk, ready to land Created 7 years, 10 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
OLDNEW
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 18
18 namespace base { 19 namespace base {
19 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
20 } 21 }
21 22
22 namespace net { 23 namespace net {
23 class IOBuffer; 24 class IOBuffer;
24 } 25 }
25 26
26 namespace disk_cache { 27 namespace disk_cache {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 net::IOBuffer* buf, 66 net::IOBuffer* buf,
66 int buf_len, 67 int buf_len,
67 const SynchronousOperationCallback& callback); 68 const SynchronousOperationCallback& callback);
68 void WriteData(int index, 69 void WriteData(int index,
69 int offset, 70 int offset,
70 net::IOBuffer* buf, 71 net::IOBuffer* buf,
71 int buf_len, 72 int buf_len,
72 const SynchronousOperationCallback& callback, 73 const SynchronousOperationCallback& callback,
73 bool truncate); 74 bool truncate);
74 75
76 const base::FilePath& path() const { return path_; }
75 std::string key() const { return key_; } 77 std::string key() const { return key_; }
76 base::Time last_used() const { return last_used_; } 78 base::Time last_used() const { return last_used_; }
77 base::Time last_modified() const { return last_modified_; } 79 base::Time last_modified() const { return last_modified_; }
78 int32 data_size(int index) const { return data_size_[index]; } 80 int32 data_size(int index) const { return data_size_[index]; }
79 81
80 private: 82 private:
81 static const int kIndexCount = 3;
82
83 SimpleSynchronousEntry( 83 SimpleSynchronousEntry(
84 const scoped_refptr<base::TaskRunner>& callback_runner, 84 const scoped_refptr<base::TaskRunner>& callback_runner,
85 const base::FilePath& path, 85 const base::FilePath& path,
86 const std::string& key); 86 const std::string& key);
87 87
88 // Like Entry, the SimpleSynchronousEntry self releases when Close() is 88 // Like Entry, the SimpleSynchronousEntry self releases when Close() is
89 // called. 89 // called.
90 ~SimpleSynchronousEntry(); 90 ~SimpleSynchronousEntry();
91 91
92 bool OpenOrCreateFiles(bool create); 92 bool OpenOrCreateFiles(bool create);
93 bool InitializeForOpen(); 93 bool InitializeForOpen();
94 bool InitializeForCreate(); 94 bool InitializeForCreate();
95 95
96 scoped_refptr<base::TaskRunner> callback_runner_; 96 scoped_refptr<base::TaskRunner> callback_runner_;
97 const base::FilePath path_; 97 const base::FilePath path_;
98 const std::string key_; 98 const std::string key_;
99 99
100 bool initialized_; 100 bool initialized_;
101 101
102 base::Time last_used_; 102 base::Time last_used_;
103 base::Time last_modified_; 103 base::Time last_modified_;
104 int32 data_size_[kIndexCount]; 104 int32 data_size_[kSimpleEntryFileCount];
105 105
106 base::PlatformFile files_[kIndexCount]; 106 base::PlatformFile files_[kSimpleEntryFileCount];
107 }; 107 };
108 108
109 } // namespace disk_cache 109 } // namespace disk_cache
110 110
111 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ 111 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_entry_impl.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698