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

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

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