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

Side by Side Diff: webkit/fileapi/file_system_usage_tracker.h

Issue 6426001: Add 1st cut of FileSystemUsageTracker that tracks the usage changes in FileSystem API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix for win Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_path_manager.cc ('k') | webkit/fileapi/file_system_usage_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Owned by the SandboxedFileSystemContext, which is a per-profile
28 // instance, and has the same lifetime as the SandboxedFileSystemContext.
29 // It's going to be created and destroyed on the IO thread in chrome.
30 // (The destruction on the same thread where it is created was guaranteed
31 // by its owner, SandboxedFileSystemContext.)
32 class FileSystemUsageTracker {
33 public:
34 FileSystemUsageTracker(
35 scoped_refptr<base::MessageLoopProxy> file_message_loop,
36 const FilePath& profile_path,
37 bool is_incognito);
38 ~FileSystemUsageTracker();
39
40 // Get the amount of data stored in the filesystem specified by
41 // |origin_url| and |type|.
42 typedef Callback1<int64 /* usage */>::Type GetUsageCallback;
43 void GetOriginUsage(const GURL& origin_url,
44 fileapi::FileSystemType type,
45 GetUsageCallback* callback);
46
47 private:
48 class GetUsageTask;
49
50 void RegisterUsageTask(GetUsageTask* task);
51 void UnregisterUsageTask(GetUsageTask* task);
52
53 void DidGetOriginUsage(const std::string& fs_name, int64 usage);
54
55 scoped_refptr<base::MessageLoopProxy> file_message_loop_;
56 FilePath base_path_;
57 bool is_incognito_;
58
59 typedef std::deque<GetUsageTask*> UsageTaskQueue;
60 UsageTaskQueue running_usage_tasks_;
61
62 typedef std::list<GetUsageCallback*> PendingCallbackList;
63 typedef std::map<std::string, PendingCallbackList> PendingUsageCallbackMap;
64 PendingUsageCallbackMap pending_usage_callbacks_;
65
66 DISALLOW_COPY_AND_ASSIGN(FileSystemUsageTracker);
67 };
68
69 } // namespace fileapi
70
71 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_path_manager.cc ('k') | webkit/fileapi/file_system_usage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698