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 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_SYSTEM_INDEXER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_SYSTEM_INDEXER_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_SYSTEM_INDEXER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_SYSTEM_INDEXER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/files/file.h" | 13 #include "base/files/file_proxy.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/platform_file.h" | |
16 | 15 |
17 class Profile; | 16 class Profile; |
18 | 17 |
19 namespace base { | 18 namespace base { |
20 class FilePath; | 19 class FilePath; |
21 class FileEnumerator; | 20 class FileEnumerator; |
22 class Time; | 21 class Time; |
23 } | 22 } |
24 | 23 |
25 namespace content { | 24 namespace content { |
(...skipping 19 matching lines...) Expand all Loading... |
45 FileSystemIndexingJob(const base::FilePath& file_system_path, | 44 FileSystemIndexingJob(const base::FilePath& file_system_path, |
46 const TotalWorkCallback& total_work_callback, | 45 const TotalWorkCallback& total_work_callback, |
47 const WorkedCallback& worked_callback, | 46 const WorkedCallback& worked_callback, |
48 const DoneCallback& done_callback); | 47 const DoneCallback& done_callback); |
49 virtual ~FileSystemIndexingJob(); | 48 virtual ~FileSystemIndexingJob(); |
50 | 49 |
51 void Start(); | 50 void Start(); |
52 void StopOnFileThread(); | 51 void StopOnFileThread(); |
53 void CollectFilesToIndex(); | 52 void CollectFilesToIndex(); |
54 void IndexFiles(); | 53 void IndexFiles(); |
55 void StartFileIndexing(base::File::Error error, | 54 void StartFileIndexing(base::File::Error error); |
56 base::PassPlatformFile pass_file, | |
57 bool); | |
58 void ReadFromFile(); | 55 void ReadFromFile(); |
59 void OnRead(base::File::Error error, | 56 void OnRead(base::File::Error error, |
60 const char* data, | 57 const char* data, |
61 int bytes_read); | 58 int bytes_read); |
62 void FinishFileIndexing(bool success); | 59 void FinishFileIndexing(bool success); |
63 void CloseFile(); | 60 void CloseFile(); |
64 void CloseCallback(base::File::Error error); | 61 void CloseCallback(base::File::Error error); |
65 void ReportWorked(); | 62 void ReportWorked(); |
66 | 63 |
67 base::FilePath file_system_path_; | 64 base::FilePath file_system_path_; |
68 TotalWorkCallback total_work_callback_; | 65 TotalWorkCallback total_work_callback_; |
69 WorkedCallback worked_callback_; | 66 WorkedCallback worked_callback_; |
70 DoneCallback done_callback_; | 67 DoneCallback done_callback_; |
71 scoped_ptr<base::FileEnumerator> file_enumerator_; | 68 scoped_ptr<base::FileEnumerator> file_enumerator_; |
72 typedef std::map<base::FilePath, base::Time> FilePathTimesMap; | 69 typedef std::map<base::FilePath, base::Time> FilePathTimesMap; |
73 FilePathTimesMap file_path_times_; | 70 FilePathTimesMap file_path_times_; |
74 FilePathTimesMap::const_iterator indexing_it_; | 71 FilePathTimesMap::const_iterator indexing_it_; |
75 base::PlatformFile current_file_; | 72 base::FileProxy current_file_; |
76 int64 current_file_offset_; | 73 int64 current_file_offset_; |
77 typedef int32 Trigram; | 74 typedef int32 Trigram; |
78 std::vector<Trigram> current_trigrams_; | 75 std::vector<Trigram> current_trigrams_; |
79 // The index in this vector is the trigram id. | 76 // The index in this vector is the trigram id. |
80 std::vector<bool> current_trigrams_set_; | 77 std::vector<bool> current_trigrams_set_; |
81 base::TimeTicks last_worked_notification_time_; | 78 base::TimeTicks last_worked_notification_time_; |
82 int files_indexed_; | 79 int files_indexed_; |
83 bool stopped_; | 80 bool stopped_; |
84 }; | 81 }; |
85 | 82 |
(...skipping 18 matching lines...) Expand all Loading... |
104 virtual ~DevToolsFileSystemIndexer(); | 101 virtual ~DevToolsFileSystemIndexer(); |
105 | 102 |
106 void SearchInPathOnFileThread(const std::string& file_system_path, | 103 void SearchInPathOnFileThread(const std::string& file_system_path, |
107 const std::string& query, | 104 const std::string& query, |
108 const SearchCallback& callback); | 105 const SearchCallback& callback); |
109 | 106 |
110 DISALLOW_COPY_AND_ASSIGN(DevToolsFileSystemIndexer); | 107 DISALLOW_COPY_AND_ASSIGN(DevToolsFileSystemIndexer); |
111 }; | 108 }; |
112 | 109 |
113 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_SYSTEM_INDEXER_H_ | 110 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_SYSTEM_INDEXER_H_ |
OLD | NEW |