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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_proxy.cc

Issue 18308004: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_system_proxy.h" 5 #include "chrome/browser/chromeos/drive/file_system_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 base::PlatformFileError error, 54 base::PlatformFileError error,
55 const base::PlatformFileInfo& file_info, 55 const base::PlatformFileInfo& file_info,
56 const base::FilePath& local_path, 56 const base::FilePath& local_path,
57 webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy) { 57 webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy) {
58 // ShareableFileReference is thread *unsafe* class. So it is necessary to 58 // ShareableFileReference is thread *unsafe* class. So it is necessary to
59 // create the instance (by invoking GetOrCreate) on IO thread, though 59 // create the instance (by invoking GetOrCreate) on IO thread, though
60 // most drive file system related operations run on UI thread. 60 // most drive file system related operations run on UI thread.
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
62 62
63 scoped_refptr<webkit_blob::ShareableFileReference> file_reference = 63 scoped_refptr<webkit_blob::ShareableFileReference> file_reference =
64 webkit_blob::ShareableFileReference::GetOrCreate( 64 webkit_blob::ShareableFileReference::GetOrCreate(webkit_blob::ScopedFile(
65 webkit_blob::ScopedFile( 65 local_path,
66 local_path, scope_out_policy, 66 scope_out_policy,
67 BrowserThread::GetMessageLoopProxyForThread( 67 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
68 BrowserThread::FILE))); 68 .get()));
69 callback.Run(error, file_info, local_path, file_reference); 69 callback.Run(error, file_info, local_path, file_reference);
70 } 70 }
71 71
72 } // namespace 72 } // namespace
73 73
74 FileSystemProxy::FileSystemProxy( 74 FileSystemProxy::FileSystemProxy(
75 FileSystemInterface* file_system) 75 FileSystemInterface* file_system)
76 : file_system_(file_system), 76 : file_system_(file_system),
77 worker_(new internal::FileApiWorker(file_system)) { 77 worker_(new internal::FileApiWorker(file_system)) {
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 FileError result, 420 FileError result,
421 const base::FilePath& local_path) { 421 const base::FilePath& local_path) {
422 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 422 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
423 423
424 scoped_refptr<ShareableFileReference> file_ref; 424 scoped_refptr<ShareableFileReference> file_ref;
425 425
426 if (result == FILE_ERROR_OK) { 426 if (result == FILE_ERROR_OK) {
427 file_ref = ShareableFileReference::GetOrCreate( 427 file_ref = ShareableFileReference::GetOrCreate(
428 local_path, 428 local_path,
429 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE, 429 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE,
430 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 430 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get());
431 file_ref->AddFinalReleaseCallback( 431 file_ref->AddFinalReleaseCallback(
432 base::Bind(&FileSystemProxy::CloseWritableSnapshotFile, 432 base::Bind(&FileSystemProxy::CloseWritableSnapshotFile,
433 this, 433 this,
434 virtual_path)); 434 virtual_path));
435 } 435 }
436 436
437 callback.Run(FileErrorToPlatformError(result), local_path, file_ref); 437 callback.Run(FileErrorToPlatformError(result), local_path, file_ref);
438 } 438 }
439 439
440 void FileSystemProxy::CloseWritableSnapshotFile( 440 void FileSystemProxy::CloseWritableSnapshotFile(
441 const base::FilePath& virtual_path, 441 const base::FilePath& virtual_path,
442 const base::FilePath& local_path) { 442 const base::FilePath& local_path) {
443 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 443 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
444 444
445 CallFileSystemMethodOnUIThread( 445 CallFileSystemMethodOnUIThread(
446 base::Bind(&internal::FileApiWorker::CloseFile, 446 base::Bind(&internal::FileApiWorker::CloseFile,
447 base::Unretained(worker_.get()), virtual_path)); 447 base::Unretained(worker_.get()), virtual_path));
448 } 448 }
449 449
450 FileSystemInterface* FileSystemProxy::GetFileSystemOnUIThread() { 450 FileSystemInterface* FileSystemProxy::GetFileSystemOnUIThread() {
451 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 451 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
452 return file_system_; 452 return file_system_;
453 } 453 }
454 454
455 } // namespace drive 455 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698