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 CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/sequenced_task_runner.h" | |
14 #include "base/task_runner.h" | |
jam
2013/06/21 19:41:59
nit: you don't need these two methods, right? you
jsbell
2013/06/21 20:37:14
Done.
| |
13 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
14 #include "content/public/browser/indexed_db_info.h" | 16 #include "content/public/browser/indexed_db_info.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
18 // Represents the per-BrowserContext IndexedDB data. | 20 // Represents the per-BrowserContext IndexedDB data. |
19 // Call these methods only on the WebKit thread. | 21 // Call these methods only via the exposed TaskRunner. |
20 class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> { | 22 class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> { |
21 public: | 23 public: |
24 // Only call the below methods by posting to this TaskRunner. | |
25 virtual base::TaskRunner* TaskRunner() const = 0; | |
26 | |
22 // Methods used in response to QuotaManager requests. | 27 // Methods used in response to QuotaManager requests. |
23 virtual std::vector<GURL> GetAllOrigins() = 0; | 28 virtual std::vector<GURL> GetAllOrigins() = 0; |
24 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() = 0; | 29 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() = 0; |
25 virtual int64 GetOriginDiskUsage(const GURL& origin_url) = 0; | 30 virtual int64 GetOriginDiskUsage(const GURL& origin_url) = 0; |
26 virtual base::Time GetOriginLastModified(const GURL& origin_url) = 0; | 31 virtual base::Time GetOriginLastModified(const GURL& origin_url) = 0; |
27 | 32 |
28 // Deletes all indexed db files for the given origin. | 33 // Deletes all indexed db files for the given origin. |
29 virtual void DeleteForOrigin(const GURL& origin_url) = 0; | 34 virtual void DeleteForOrigin(const GURL& origin_url) = 0; |
30 | 35 |
31 // Get the file name of the local storage file for the given origin. | 36 // Get the file name of the local storage file for the given origin. |
32 virtual base::FilePath GetFilePathForTesting( | 37 virtual base::FilePath GetFilePathForTesting( |
33 const std::string& origin_id) const = 0; | 38 const std::string& origin_id) const = 0; |
39 // Set the task runner for tests if browser main loop is not initialized. | |
40 virtual void SetTaskRunnerForTesting( | |
41 base::SequencedTaskRunner* task_runner) = 0; | |
34 | 42 |
35 protected: | 43 protected: |
36 friend class base::RefCountedThreadSafe<IndexedDBContext>; | 44 friend class base::RefCountedThreadSafe<IndexedDBContext>; |
37 virtual ~IndexedDBContext() {} | 45 virtual ~IndexedDBContext() {} |
38 }; | 46 }; |
39 | 47 |
40 } // namespace content | 48 } // namespace content |
41 | 49 |
42 #endif // CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ | 50 #endif // CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ |
OLD | NEW |