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

Unified Diff: chrome/browser/devtools/devtools_file_system_indexer.cc

Issue 231313002: Migrate DevToolsFileSystemIndexer to base::FileProxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/devtools_file_system_indexer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_file_system_indexer.cc
diff --git a/chrome/browser/devtools/devtools_file_system_indexer.cc b/chrome/browser/devtools/devtools_file_system_indexer.cc
index 9a281db855c615623c936319eb8a2d27c6ea1522..7e0d6fcbd04b67273fbce0939f3d9d363758a76a 100644
--- a/chrome/browser/devtools/devtools_file_system_indexer.cc
+++ b/chrome/browser/devtools/devtools_file_system_indexer.cc
@@ -21,7 +21,6 @@ using base::Bind;
using base::Callback;
using base::FileEnumerator;
using base::FilePath;
-using base::FileUtilProxy;
using base::Time;
using base::TimeDelta;
using base::TimeTicks;
@@ -269,6 +268,8 @@ DevToolsFileSystemIndexer::FileSystemIndexingJob::FileSystemIndexingJob(
total_work_callback_(total_work_callback),
worked_callback_(worked_callback),
done_callback_(done_callback),
+ current_file_(BrowserThread::GetMessageLoopProxyForThread(
+ BrowserThread::FILE).get()),
files_indexed_(0),
stopped_(false) {
current_trigrams_set_.resize(kTrigramCount);
@@ -337,23 +338,18 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::IndexFiles() {
return;
}
FilePath file_path = indexing_it_->first;
- FileUtilProxy::CreateOrOpen(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
- file_path,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
- Bind(&FileSystemIndexingJob::StartFileIndexing, this));
+ current_file_.CreateOrOpen(
+ file_path,
+ base::File::FLAG_OPEN | base::File::FLAG_READ,
+ Bind(&FileSystemIndexingJob::StartFileIndexing, this));
}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::StartFileIndexing(
- base::File::Error error,
- PassPlatformFile pass_file,
- bool) {
- if (error != base::File::FILE_OK) {
- current_file_ = base::kInvalidPlatformFileValue;
+ base::File::Error error) {
+ if (!current_file_.IsValid()) {
FinishFileIndexing(false);
return;
}
- current_file_ = pass_file.ReleaseValue();
current_file_offset_ = 0;
current_trigrams_.clear();
std::fill(current_trigrams_set_.begin(), current_trigrams_set_.end(), false);
@@ -365,12 +361,8 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::ReadFromFile() {
CloseFile();
return;
}
- FileUtilProxy::Read(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
- current_file_,
- current_file_offset_,
- kMaxReadLength,
- Bind(&FileSystemIndexingJob::OnRead, this));
+ current_file_.Read(current_file_offset_, kMaxReadLength,
+ Bind(&FileSystemIndexingJob::OnRead, this));
}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::OnRead(
@@ -425,12 +417,8 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::FinishFileIndexing(
}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::CloseFile() {
- if (current_file_ != base::kInvalidPlatformFileValue) {
- FileUtilProxy::Close(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
- current_file_,
- Bind(&FileSystemIndexingJob::CloseCallback, this));
- }
+ if (current_file_.IsValid())
+ current_file_.Close(Bind(&FileSystemIndexingJob::CloseCallback, this));
}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::CloseCallback(
« no previous file with comments | « chrome/browser/devtools/devtools_file_system_indexer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698