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

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

Issue 2815563002: Avoid cross thread malloc / free pair of IOBuffer on the simple cache (Closed)
Patch Set: +comment Created 3 years, 8 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
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_entry_impl.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) 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>
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 // Called after an asynchronous read. Updates |crc32s_| if possible. 247 // Called after an asynchronous read. Updates |crc32s_| if possible.
248 void ReadOperationComplete(int stream_index, 248 void ReadOperationComplete(int stream_index,
249 int offset, 249 int offset,
250 const CompletionCallback& completion_callback, 250 const CompletionCallback& completion_callback,
251 std::unique_ptr<uint32_t> read_crc32, 251 std::unique_ptr<uint32_t> read_crc32,
252 std::unique_ptr<SimpleEntryStat> entry_stat, 252 std::unique_ptr<SimpleEntryStat> entry_stat,
253 std::unique_ptr<int> result); 253 std::unique_ptr<int> result);
254 254
255 // Called after an asynchronous write completes. 255 // Called after an asynchronous write completes.
256 // |buf| parameter brings back a reference to net::IOBuffer to the original
257 // thread, so that we can reduce cross thread malloc/free pair.
258 // See http://crbug.com/708644 for details.
256 void WriteOperationComplete(int stream_index, 259 void WriteOperationComplete(int stream_index,
257 const CompletionCallback& completion_callback, 260 const CompletionCallback& completion_callback,
258 std::unique_ptr<SimpleEntryStat> entry_stat, 261 std::unique_ptr<SimpleEntryStat> entry_stat,
259 std::unique_ptr<int> result); 262 std::unique_ptr<int> result,
263 net::IOBuffer* buf);
260 264
261 void ReadSparseOperationComplete( 265 void ReadSparseOperationComplete(
262 const CompletionCallback& completion_callback, 266 const CompletionCallback& completion_callback,
263 std::unique_ptr<base::Time> last_used, 267 std::unique_ptr<base::Time> last_used,
264 std::unique_ptr<int> result); 268 std::unique_ptr<int> result);
265 269
266 void WriteSparseOperationComplete( 270 void WriteSparseOperationComplete(
267 const CompletionCallback& completion_callback, 271 const CompletionCallback& completion_callback,
268 std::unique_ptr<SimpleEntryStat> entry_stat, 272 std::unique_ptr<SimpleEntryStat> entry_stat,
269 std::unique_ptr<int> result); 273 std::unique_ptr<int> result);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // 1 on disk, to reduce the number of file descriptors and save disk space. 389 // 1 on disk, to reduce the number of file descriptors and save disk space.
386 // This strategy allows stream 1 to change size easily. Since stream 0 is only 390 // This strategy allows stream 1 to change size easily. Since stream 0 is only
387 // used to write HTTP headers, the memory consumption of keeping it in memory 391 // used to write HTTP headers, the memory consumption of keeping it in memory
388 // is acceptable. 392 // is acceptable.
389 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; 393 scoped_refptr<net::GrowableIOBuffer> stream_0_data_;
390 }; 394 };
391 395
392 } // namespace disk_cache 396 } // namespace disk_cache
393 397
394 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ 398 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698