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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc

Issue 578533002: Removing remaining CrOS implicit conversions from scoped_refptr to T* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h" 5 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system .h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 base::File::FILE_OK)); 211 base::File::FILE_OK));
212 } 212 }
213 213
214 const FakeEntry* const entry = entry_it->second.get(); 214 const FakeEntry* const entry = entry_it->second.get();
215 std::vector<int> task_ids; 215 std::vector<int> task_ids;
216 while (current_offset < entry->metadata->size && current_length) { 216 while (current_offset < entry->metadata->size && current_length) {
217 buffer->data()[current_offset - offset] = entry->contents[current_offset]; 217 buffer->data()[current_offset - offset] = entry->contents[current_offset];
218 const bool has_more = 218 const bool has_more =
219 (current_offset + 1 < entry->metadata->size) && (current_length - 1); 219 (current_offset + 1 < entry->metadata->size) && (current_length - 1);
220 const int task_id = tracker_.PostTask( 220 const int task_id = tracker_.PostTask(
221 base::MessageLoopProxy::current(), 221 base::MessageLoopProxy::current().get(),
222 FROM_HERE, 222 FROM_HERE,
223 base::Bind( 223 base::Bind(
224 callback, 1 /* chunk_length */, has_more, base::File::FILE_OK)); 224 callback, 1 /* chunk_length */, has_more, base::File::FILE_OK));
225 task_ids.push_back(task_id); 225 task_ids.push_back(task_id);
226 current_offset++; 226 current_offset++;
227 current_length--; 227 current_length--;
228 } 228 }
229 229
230 return base::Bind(&FakeProvidedFileSystem::AbortMany, 230 return base::Bind(&FakeProvidedFileSystem::AbortMany,
231 weak_ptr_factory_.GetWeakPtr(), 231 weak_ptr_factory_.GetWeakPtr(),
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return new FakeProvidedFileSystem(file_system_info); 337 return new FakeProvidedFileSystem(file_system_info);
338 } 338 }
339 339
340 base::WeakPtr<ProvidedFileSystemInterface> 340 base::WeakPtr<ProvidedFileSystemInterface>
341 FakeProvidedFileSystem::GetWeakPtr() { 341 FakeProvidedFileSystem::GetWeakPtr() {
342 return weak_ptr_factory_.GetWeakPtr(); 342 return weak_ptr_factory_.GetWeakPtr();
343 } 343 }
344 344
345 ProvidedFileSystemInterface::AbortCallback 345 ProvidedFileSystemInterface::AbortCallback
346 FakeProvidedFileSystem::PostAbortableTask(const base::Closure& callback) { 346 FakeProvidedFileSystem::PostAbortableTask(const base::Closure& callback) {
347 const int task_id = 347 const int task_id = tracker_.PostTask(
348 tracker_.PostTask(base::MessageLoopProxy::current(), FROM_HERE, callback); 348 base::MessageLoopProxy::current().get(), FROM_HERE, callback);
349 return base::Bind( 349 return base::Bind(
350 &FakeProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), task_id); 350 &FakeProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), task_id);
351 } 351 }
352 352
353 void FakeProvidedFileSystem::Abort( 353 void FakeProvidedFileSystem::Abort(
354 int task_id, 354 int task_id,
355 const storage::AsyncFileUtil::StatusCallback& callback) { 355 const storage::AsyncFileUtil::StatusCallback& callback) {
356 tracker_.TryCancel(task_id); 356 tracker_.TryCancel(task_id);
357 callback.Run(base::File::FILE_OK); 357 callback.Run(base::File::FILE_OK);
358 } 358 }
359 359
360 void FakeProvidedFileSystem::AbortMany( 360 void FakeProvidedFileSystem::AbortMany(
361 const std::vector<int>& task_ids, 361 const std::vector<int>& task_ids,
362 const storage::AsyncFileUtil::StatusCallback& callback) { 362 const storage::AsyncFileUtil::StatusCallback& callback) {
363 for (size_t i = 0; i < task_ids.size(); ++i) { 363 for (size_t i = 0; i < task_ids.size(); ++i) {
364 tracker_.TryCancel(task_ids[i]); 364 tracker_.TryCancel(task_ids[i]);
365 } 365 }
366 callback.Run(base::File::FILE_OK); 366 callback.Run(base::File::FILE_OK);
367 } 367 }
368 368
369 } // namespace file_system_provider 369 } // namespace file_system_provider
370 } // namespace chromeos 370 } // namespace chromeos
OLDNEW
« no previous file with comments | « athena/extensions/shell/extensions_delegate_impl.cc ('k') | chrome/browser/chromeos/fileapi/file_system_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698