OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/devtools/devtools_file_system_indexer.h" | 5 #include "chrome/browser/devtools/devtools_file_system_indexer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <iterator> | 9 #include <iterator> |
10 | 10 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 DevToolsFileSystemIndexer::FileSystemIndexingJob::FileSystemIndexingJob( | 254 DevToolsFileSystemIndexer::FileSystemIndexingJob::FileSystemIndexingJob( |
255 const FilePath& file_system_path, | 255 const FilePath& file_system_path, |
256 const TotalWorkCallback& total_work_callback, | 256 const TotalWorkCallback& total_work_callback, |
257 const WorkedCallback& worked_callback, | 257 const WorkedCallback& worked_callback, |
258 const DoneCallback& done_callback) | 258 const DoneCallback& done_callback) |
259 : file_system_path_(file_system_path), | 259 : file_system_path_(file_system_path), |
260 total_work_callback_(total_work_callback), | 260 total_work_callback_(total_work_callback), |
261 worked_callback_(worked_callback), | 261 worked_callback_(worked_callback), |
262 done_callback_(done_callback), | 262 done_callback_(done_callback), |
263 current_file_(BrowserThread::GetMessageLoopProxyForThread( | 263 current_file_( |
264 BrowserThread::FILE).get()), | 264 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()), |
265 files_indexed_(0), | 265 files_indexed_(0), |
266 stopped_(false) { | 266 stopped_(false) { |
267 current_trigrams_set_.resize(kTrigramCount); | 267 current_trigrams_set_.resize(kTrigramCount); |
268 current_trigrams_.reserve(kTrigramCount); | 268 current_trigrams_.reserve(kTrigramCount); |
269 } | 269 } |
270 | 270 |
271 DevToolsFileSystemIndexer::FileSystemIndexingJob::~FileSystemIndexingJob() {} | 271 DevToolsFileSystemIndexer::FileSystemIndexingJob::~FileSystemIndexingJob() {} |
272 | 272 |
273 void DevToolsFileSystemIndexer::FileSystemIndexingJob::Start() { | 273 void DevToolsFileSystemIndexer::FileSystemIndexingJob::Start() { |
274 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 274 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 vector<FilePath> file_paths = g_trigram_index.Get().Search(query); | 477 vector<FilePath> file_paths = g_trigram_index.Get().Search(query); |
478 vector<string> result; | 478 vector<string> result; |
479 FilePath path = FilePath::FromUTF8Unsafe(file_system_path); | 479 FilePath path = FilePath::FromUTF8Unsafe(file_system_path); |
480 vector<FilePath>::const_iterator it = file_paths.begin(); | 480 vector<FilePath>::const_iterator it = file_paths.begin(); |
481 for (; it != file_paths.end(); ++it) { | 481 for (; it != file_paths.end(); ++it) { |
482 if (path.IsParent(*it)) | 482 if (path.IsParent(*it)) |
483 result.push_back(it->AsUTF8Unsafe()); | 483 result.push_back(it->AsUTF8Unsafe()); |
484 } | 484 } |
485 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, Bind(callback, result)); | 485 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, Bind(callback, result)); |
486 } | 486 } |
OLD | NEW |