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

Side by Side Diff: chrome/browser/chromeos/drive/fileapi/fileapi_worker.cc

Issue 1124813003: [chrome/browser/chromeos/drive] Avoid use of MessageLoopProxy by use of TTRH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/drive/fileapi/fileapi_worker.h" 5 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "base/thread_task_runner_handle.h"
10 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
11 #include "chrome/browser/chromeos/drive/drive.pb.h" 12 #include "chrome/browser/chromeos/drive/drive.pb.h"
12 #include "chrome/browser/chromeos/drive/file_errors.h" 13 #include "chrome/browser/chromeos/drive/file_errors.h"
13 #include "chrome/browser/chromeos/drive/file_system_interface.h" 14 #include "chrome/browser/chromeos/drive/file_system_interface.h"
14 #include "chrome/browser/chromeos/drive/file_system_util.h" 15 #include "chrome/browser/chromeos/drive/file_system_util.h"
15 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" 16 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "storage/browser/fileapi/file_system_url.h" 18 #include "storage/browser/fileapi/file_system_url.h"
18 #include "storage/common/fileapi/directory_entry.h" 19 #include "storage/common/fileapi/directory_entry.h"
19 20
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // Returns an error if any unsupported flag is found. 334 // Returns an error if any unsupported flag is found.
334 if (file_flags & ~(base::File::FLAG_OPEN | 335 if (file_flags & ~(base::File::FLAG_OPEN |
335 base::File::FLAG_CREATE | 336 base::File::FLAG_CREATE |
336 base::File::FLAG_OPEN_ALWAYS | 337 base::File::FLAG_OPEN_ALWAYS |
337 base::File::FLAG_CREATE_ALWAYS | 338 base::File::FLAG_CREATE_ALWAYS |
338 base::File::FLAG_OPEN_TRUNCATED | 339 base::File::FLAG_OPEN_TRUNCATED |
339 base::File::FLAG_READ | 340 base::File::FLAG_READ |
340 base::File::FLAG_WRITE | 341 base::File::FLAG_WRITE |
341 base::File::FLAG_WRITE_ATTRIBUTES | 342 base::File::FLAG_WRITE_ATTRIBUTES |
342 base::File::FLAG_APPEND)) { 343 base::File::FLAG_APPEND)) {
343 base::MessageLoopProxy::current()->PostTask( 344 base::ThreadTaskRunnerHandle::Get()->PostTask(
344 FROM_HERE, 345 FROM_HERE,
345 base::Bind(callback, 346 base::Bind(callback, Passed(base::File(base::File::FILE_ERROR_FAILED)),
346 Passed(base::File(base::File::FILE_ERROR_FAILED)),
347 base::Closure())); 347 base::Closure()));
348 return; 348 return;
349 } 349 }
350 350
351 file_system->OpenFile( 351 file_system->OpenFile(
352 file_path, GetOpenMode(file_flags), 352 file_path, GetOpenMode(file_flags),
353 std::string(), // no mime type; guess from file_path 353 std::string(), // no mime type; guess from file_path
354 base::Bind(&OpenFileAfterFileSystemOpenFile, file_flags, callback)); 354 base::Bind(&OpenFileAfterFileSystemOpenFile, file_flags, callback));
355 } 355 }
356 356
357 void TouchFile(const base::FilePath& file_path, 357 void TouchFile(const base::FilePath& file_path,
358 const base::Time& last_access_time, 358 const base::Time& last_access_time,
359 const base::Time& last_modified_time, 359 const base::Time& last_modified_time,
360 const StatusCallback& callback, 360 const StatusCallback& callback,
361 FileSystemInterface* file_system) { 361 FileSystemInterface* file_system) {
362 DCHECK_CURRENTLY_ON(BrowserThread::UI); 362 DCHECK_CURRENTLY_ON(BrowserThread::UI);
363 file_system->TouchFile(file_path, last_access_time, last_modified_time, 363 file_system->TouchFile(file_path, last_access_time, last_modified_time,
364 base::Bind(&RunStatusCallbackByFileError, callback)); 364 base::Bind(&RunStatusCallbackByFileError, callback));
365 365
366 } 366 }
367 367
368 } // namespace fileapi_internal 368 } // namespace fileapi_internal
369 } // namespace drive 369 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698