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

Side by Side Diff: net/disk_cache/blockfile/file_ios.cc

Issue 2854243003: Use constexpr TaskTraits constructor in net. (Closed)
Patch Set: Created 3 years, 7 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 | « net/base/directory_lister.cc ('k') | net/disk_cache/cache_util.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "net/disk_cache/blockfile/file.h" 5 #include "net/disk_cache/blockfile/file.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 // --------------------------------------------------------------------------- 116 // ---------------------------------------------------------------------------
117 117
118 void FileInFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len, 118 void FileInFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len,
119 size_t offset, disk_cache::FileIOCallback *callback) { 119 size_t offset, disk_cache::FileIOCallback *callback) {
120 scoped_refptr<FileBackgroundIO> operation( 120 scoped_refptr<FileBackgroundIO> operation(
121 new FileBackgroundIO(file, buf, buf_len, offset, callback, this)); 121 new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
122 file->AddRef(); // Balanced on OnOperationComplete() 122 file->AddRef(); // Balanced on OnOperationComplete()
123 123
124 base::PostTaskWithTraits( 124 base::PostTaskWithTraits(
125 FROM_HERE, base::TaskTraits() 125 FROM_HERE,
126 .WithShutdownBehavior( 126 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
127 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
128 .MayBlock(),
129 base::Bind(&FileBackgroundIO::Read, operation.get())); 127 base::Bind(&FileBackgroundIO::Read, operation.get()));
130 OnOperationPosted(operation.get()); 128 OnOperationPosted(operation.get());
131 } 129 }
132 130
133 void FileInFlightIO::PostWrite(disk_cache::File* file, const void* buf, 131 void FileInFlightIO::PostWrite(disk_cache::File* file, const void* buf,
134 size_t buf_len, size_t offset, 132 size_t buf_len, size_t offset,
135 disk_cache::FileIOCallback* callback) { 133 disk_cache::FileIOCallback* callback) {
136 scoped_refptr<FileBackgroundIO> operation( 134 scoped_refptr<FileBackgroundIO> operation(
137 new FileBackgroundIO(file, buf, buf_len, offset, callback, this)); 135 new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
138 file->AddRef(); // Balanced on OnOperationComplete() 136 file->AddRef(); // Balanced on OnOperationComplete()
139 137
140 base::PostTaskWithTraits( 138 base::PostTaskWithTraits(
141 FROM_HERE, base::TaskTraits() 139 FROM_HERE,
142 .WithShutdownBehavior( 140 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
143 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
144 .MayBlock(),
145 base::Bind(&FileBackgroundIO::Write, operation.get())); 141 base::Bind(&FileBackgroundIO::Write, operation.get()));
146 OnOperationPosted(operation.get()); 142 OnOperationPosted(operation.get());
147 } 143 }
148 144
149 // Runs on the IO thread. 145 // Runs on the IO thread.
150 void FileInFlightIO::OnOperationComplete(disk_cache::BackgroundIO* operation, 146 void FileInFlightIO::OnOperationComplete(disk_cache::BackgroundIO* operation,
151 bool cancel) { 147 bool cancel) {
152 FileBackgroundIO* op = static_cast<FileBackgroundIO*>(operation); 148 FileBackgroundIO* op = static_cast<FileBackgroundIO*>(operation);
153 149
154 disk_cache::FileIOCallback* callback = op->callback(); 150 disk_cache::FileIOCallback* callback = op->callback();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return false; 298 return false;
303 299
304 GetFileInFlightIO()->PostWrite(this, buffer, buffer_len, offset, callback); 300 GetFileInFlightIO()->PostWrite(this, buffer, buffer_len, offset, callback);
305 301
306 if (completed) 302 if (completed)
307 *completed = false; 303 *completed = false;
308 return true; 304 return true;
309 } 305 }
310 306
311 } // namespace disk_cache 307 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/base/directory_lister.cc ('k') | net/disk_cache/cache_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698