Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_TRACKER_H_ | |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_TRACKER_H_ | |
| 7 | |
| 8 #include <deque> | |
| 9 #include <list> | |
| 10 #include <map> | |
| 11 #include <string> | |
| 12 | |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/callback.h" | |
| 15 #include "base/file_path.h" | |
| 16 #include "base/ref_counted.h" | |
| 17 #include "webkit/fileapi/file_system_types.h" | |
| 18 | |
| 19 class GURL; | |
| 20 | |
| 21 namespace base { | |
| 22 class MessageLoopProxy; | |
| 23 } | |
| 24 | |
| 25 namespace fileapi { | |
| 26 | |
| 27 class FileSystemUsageTracker { | |
|
ericu
2011/02/09 02:05:22
What's the lifetime of this object? Is there guar
kinuko
2011/02/09 05:22:36
Added comments, as I interpreted your questions as
ericu
2011/02/09 23:03:37
Great--thanks.
| |
| 28 public: | |
| 29 FileSystemUsageTracker( | |
| 30 scoped_refptr<base::MessageLoopProxy> file_message_loop, | |
| 31 const FilePath& profile_path, | |
| 32 bool is_incognito); | |
| 33 ~FileSystemUsageTracker(); | |
| 34 | |
| 35 // Get the amount of data stored in the filesystem specified by | |
| 36 // |origin_url| and |type|. | |
| 37 typedef Callback1<int64 /* usage */>::Type GetUsageCallback; | |
| 38 void GetOriginUsage(const GURL& origin_url, | |
| 39 fileapi::FileSystemType type, | |
| 40 GetUsageCallback* callback); | |
| 41 | |
| 42 private: | |
| 43 class GetUsageTask; | |
| 44 friend class GetUsageTask; | |
|
michaeln
2011/02/09 00:25:36
since it's an inner class, do you need the 'friend
kinuko
2011/02/09 05:22:36
Well... I'm not sure if it works in all the compil
| |
| 45 | |
| 46 void RegisterUsageTask(GetUsageTask* task); | |
| 47 void UnregisterUsageTask(GetUsageTask* task); | |
|
ericu
2011/02/09 02:05:22
I'd probably call these [Un]RegisterGetUsageTask,
kinuko
2011/02/09 05:22:36
Agreed, except that the method names reflect the f
ericu
2011/02/09 23:03:37
OK.
| |
| 48 | |
| 49 void DidGetOriginUsage(const std::string& fs_name, int64 usage); | |
| 50 | |
| 51 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | |
| 52 FilePath base_path_; | |
| 53 bool is_incognito_; | |
| 54 | |
| 55 typedef std::deque<GetUsageTask*> UsageTaskQueue; | |
| 56 UsageTaskQueue running_usage_tasks_; | |
| 57 | |
| 58 typedef std::list<GetUsageCallback*> PendingCallbackList; | |
| 59 typedef std::map<std::string, PendingCallbackList> PendingUsageCallbackMap; | |
| 60 PendingUsageCallbackMap pending_usage_callbacks_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(FileSystemUsageTracker); | |
| 63 }; | |
| 64 | |
| 65 } // namespace fileapi | |
| 66 | |
| 67 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_TRACKER_H_ | |
| OLD | NEW |