Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GDATA_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 namespace base { | 27 namespace base { |
| 28 class SequencedTaskRunner; | 28 class SequencedTaskRunner; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace gdata { | 31 namespace gdata { |
| 32 | 32 |
| 33 class DocumentsServiceInterface; | 33 class DocumentsServiceInterface; |
| 34 class DriveWebAppsRegistryInterface; | 34 class DriveWebAppsRegistryInterface; |
| 35 class GDataUploaderInterface; | 35 class GDataUploaderInterface; |
| 36 class GDataWapiFeedLoader; | 36 class GDataWapiFeedLoader; |
| 37 class StaleCacheFilesRemover; | |
| 37 struct UploadFileInfo; | 38 struct UploadFileInfo; |
| 38 | 39 |
| 39 // The production implementation of GDataFileSystemInterface. | 40 // The production implementation of GDataFileSystemInterface. |
| 40 class GDataFileSystem : public GDataFileSystemInterface, | 41 class GDataFileSystem : public GDataFileSystemInterface, |
| 41 public GDataWapiFeedLoader::Observer, | 42 public GDataWapiFeedLoader::Observer, |
| 42 public content::NotificationObserver { | 43 public content::NotificationObserver { |
| 43 public: | 44 public: |
| 44 GDataFileSystem(Profile* profile, | 45 GDataFileSystem(Profile* profile, |
| 45 GDataCache* cache, | 46 GDataCache* cache, |
| 46 DocumentsServiceInterface* documents_service, | 47 DocumentsServiceInterface* documents_service, |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 802 GDataFileError error, | 803 GDataFileError error, |
| 803 const std::string& resource_id, | 804 const std::string& resource_id, |
| 804 const std::string& md5, | 805 const std::string& md5, |
| 805 const FilePath& local_cache_path); | 806 const FilePath& local_cache_path); |
| 806 void CheckLocalModificationAndRunAfterGetFileInfo( | 807 void CheckLocalModificationAndRunAfterGetFileInfo( |
| 807 scoped_ptr<GDataEntryProto> entry_proto, | 808 scoped_ptr<GDataEntryProto> entry_proto, |
| 808 const GetEntryInfoCallback& callback, | 809 const GetEntryInfoCallback& callback, |
| 809 base::PlatformFileInfo* file_info, | 810 base::PlatformFileInfo* file_info, |
| 810 bool* get_file_info_result); | 811 bool* get_file_info_result); |
| 811 | 812 |
| 812 // All members should be accessed only on UI thread. Do not post tasks to | |
| 813 // other threads with base::Unretained(this). | |
| 814 scoped_ptr<GDataDirectoryService> directory_service_; | |
| 815 | |
| 816 // The profile hosts the GDataFileSystem via GDataSystemService. | 813 // The profile hosts the GDataFileSystem via GDataSystemService. |
| 817 Profile* profile_; | 814 Profile* profile_; |
| 818 | 815 |
| 819 // The cache owned by GDataSystemService. | 816 // The cache owned by GDataSystemService. |
| 820 GDataCache* cache_; | 817 GDataCache* cache_; |
| 821 | 818 |
| 822 // The uploader owned by GDataSystemService. | 819 // The uploader owned by GDataSystemService. |
| 823 GDataUploaderInterface* uploader_; | 820 GDataUploaderInterface* uploader_; |
| 824 | 821 |
| 825 // The document service owned by GDataSystemService. | 822 // The document service owned by GDataSystemService. |
| 826 DocumentsServiceInterface* documents_service_; | 823 DocumentsServiceInterface* documents_service_; |
| 827 | 824 |
| 828 // The webapps registry owned by GDataSystemService. | 825 // The webapps registry owned by GDataSystemService. |
| 829 DriveWebAppsRegistryInterface* webapps_registry_; | 826 DriveWebAppsRegistryInterface* webapps_registry_; |
| 830 | 827 |
| 831 // Periodic timer for checking updates. | 828 // Periodic timer for checking updates. |
| 832 base::Timer update_timer_; | 829 base::Timer update_timer_; |
| 833 | 830 |
| 834 // True if hosted documents should be hidden. | 831 // True if hosted documents should be hidden. |
| 835 bool hide_hosted_docs_; | 832 bool hide_hosted_docs_; |
| 836 | 833 |
| 837 // The set of paths opened by OpenFile but not yet closed by CloseFile. | 834 // The set of paths opened by OpenFile but not yet closed by CloseFile. |
| 838 std::set<FilePath> open_files_; | 835 std::set<FilePath> open_files_; |
| 839 | 836 |
| 837 // Note: |observers_| should be placed before all the objects this class owns, | |
| 838 // because some of them may add themselves into the observers, so this should | |
| 839 // be constructed before them and be destructed after them. | |
|
satorux1
2012/08/21 20:57:06
Wow, that's subtle. If so, why don't you move this
satorux1
2012/08/21 21:29:06
Sorry, I misunderstood. So the observer list has t
| |
| 840 ObserverList<GDataFileSystemInterface::Observer> observers_; | |
| 841 | |
| 842 // All members should be accessed only on UI thread. Do not post tasks to | |
| 843 // other threads with base::Unretained(this). | |
| 844 scoped_ptr<GDataDirectoryService> directory_service_; | |
| 845 | |
| 840 scoped_ptr<PrefChangeRegistrar> pref_registrar_; | 846 scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
| 841 | 847 |
| 842 // The loader is used to load the feeds. | 848 // The loader is used to load the feeds. |
| 843 scoped_ptr<GDataWapiFeedLoader> feed_loader_; | 849 scoped_ptr<GDataWapiFeedLoader> feed_loader_; |
| 844 | 850 |
| 845 ObserverList<GDataFileSystemInterface::Observer> observers_; | 851 // The remover is used to remove stale cache files. |
| 852 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_; | |
| 846 | 853 |
| 847 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 854 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 848 | 855 |
| 849 // WeakPtrFactory and WeakPtr bound to the UI thread. | 856 // WeakPtrFactory and WeakPtr bound to the UI thread. |
| 850 // Note: These should remain the last member so they'll be destroyed and | 857 // Note: These should remain the last member so they'll be destroyed and |
| 851 // invalidate the weak pointers before any other members are destroyed. | 858 // invalidate the weak pointers before any other members are destroyed. |
| 852 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 859 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
| 853 // Unlike other classes, we need this as we need this to redirect a task | 860 // Unlike other classes, we need this as we need this to redirect a task |
| 854 // from IO thread to UI thread. | 861 // from IO thread to UI thread. |
| 855 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 862 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
| 856 }; | 863 }; |
| 857 | 864 |
| 858 } // namespace gdata | 865 } // namespace gdata |
| 859 | 866 |
| 860 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 867 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| OLD | NEW |