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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_watcher.h

Issue 2965903002: Revert of file_manager: Migrate FILE thread to TaskScheduler (Closed)
Patch Set: Created 3 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
OLDNEW
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_CHROMEOS_FILE_MANAGER_FILE_WATCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_WATCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_WATCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_WATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_path_watcher.h" 13 #include "base/files/file_path_watcher.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/sequenced_task_runner.h"
16 15
17 namespace file_manager { 16 namespace file_manager {
18 17
19 // This class is used to watch changes in the given virtual path, remember 18 // This class is used to watch changes in the given virtual path, remember
20 // what extensions are watching the path. 19 // what extensions are watching the path.
21 // 20 //
22 // For local files, the class maintains a FilePathWatcher instance and 21 // For local files, the class maintains a FilePathWatcher instance and
23 // remembers what extensions are watching the path. 22 // remembers what extensions are watching the path.
24 // 23 //
25 // For remote files (ex. files on Drive), the class just remembers what 24 // For remote files (ex. files on Drive), the class just remembers what
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const base::FilePath& local_path, 63 const base::FilePath& local_path,
65 const base::FilePathWatcher::Callback& file_watcher_callback, 64 const base::FilePathWatcher::Callback& file_watcher_callback,
66 const BoolCallback& callback); 65 const BoolCallback& callback);
67 66
68 private: 67 private:
69 // Called when a FilePathWatcher is created and started. 68 // Called when a FilePathWatcher is created and started.
70 // |file_path_watcher| is NULL, if the watcher wasn't started successfully. 69 // |file_path_watcher| is NULL, if the watcher wasn't started successfully.
71 void OnWatcherStarted(const BoolCallback& callback, 70 void OnWatcherStarted(const BoolCallback& callback,
72 base::FilePathWatcher* file_path_watcher); 71 base::FilePathWatcher* file_path_watcher);
73 72
74 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;
75 base::FilePathWatcher* local_file_watcher_; 73 base::FilePathWatcher* local_file_watcher_;
76 base::FilePath virtual_path_; 74 base::FilePath virtual_path_;
77 // Map of extension-id to counter. See the comment at AddExtension() for 75 // Map of extension-id to counter. See the comment at AddExtension() for
78 // why we need to count. 76 // why we need to count.
79 typedef std::map<std::string, int> ExtensionCountMap; 77 typedef std::map<std::string, int> ExtensionCountMap;
80 ExtensionCountMap extensions_; 78 ExtensionCountMap extensions_;
81 79
82 // Note: This should remain the last member so it'll be destroyed and 80 // Note: This should remain the last member so it'll be destroyed and
83 // invalidate the weak pointers before any other members are destroyed. 81 // invalidate the weak pointers before any other members are destroyed.
84 base::WeakPtrFactory<FileWatcher> weak_ptr_factory_; 82 base::WeakPtrFactory<FileWatcher> weak_ptr_factory_;
85 }; 83 };
86 84
87 } // namespace file_manager 85 } // namespace file_manager
88 86
89 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_WATCHER_H_ 87 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_WATCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_browser_handlers.cc ('k') | chrome/browser/chromeos/file_manager/file_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698