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 WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 unsigned Length(); | 38 unsigned Length(); |
39 NullableString16 Key(unsigned index); | 39 NullableString16 Key(unsigned index); |
40 NullableString16 GetItem(const string16& key); | 40 NullableString16 GetItem(const string16& key); |
41 bool SetItem(const string16& key, const string16& value, | 41 bool SetItem(const string16& key, const string16& value, |
42 NullableString16* old_value); | 42 NullableString16* old_value); |
43 bool RemoveItem(const string16& key, string16* old_value); | 43 bool RemoveItem(const string16& key, string16* old_value); |
44 bool Clear(); | 44 bool Clear(); |
45 | 45 |
46 DomStorageArea* ShallowCopy(int64 destination_namespace_id); | 46 DomStorageArea* ShallowCopy(int64 destination_namespace_id); |
47 | 47 |
| 48 static FilePath DatabaseFileNameFromOrigin(const GURL& origin); |
| 49 |
48 private: | 50 private: |
49 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics); | 51 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics); |
50 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); | 52 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); |
51 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, TestDatabaseFilePath); | 53 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, TestDatabaseFilePath); |
52 friend class base::RefCountedThreadSafe<DomStorageArea>; | 54 friend class base::RefCountedThreadSafe<DomStorageArea>; |
53 | 55 |
54 // If we haven't done so already and this is a local storage area, | 56 // If we haven't done so already and this is a local storage area, |
55 // will attempt to read any values for this origin currently | 57 // will attempt to read any values for this origin currently |
56 // stored on disk. | 58 // stored on disk. |
57 void InitialImportIfNeeded(); | 59 void InitialImportIfNeeded(); |
58 | 60 |
59 // Posts a task to write the set of changed values to disk. | 61 // Posts a task to write the set of changed values to disk. |
60 void ScheduleCommitChanges(); | 62 void ScheduleCommitChanges(); |
61 void CommitChanges(); | 63 void CommitChanges(); |
62 | 64 |
63 static FilePath DatabaseFileNameFromOrigin(const GURL& origin); | |
64 | |
65 ~DomStorageArea(); | 65 ~DomStorageArea(); |
66 | 66 |
67 int64 namespace_id_; | 67 int64 namespace_id_; |
68 GURL origin_; | 68 GURL origin_; |
69 FilePath directory_; | 69 FilePath directory_; |
70 scoped_refptr<DomStorageTaskRunner> task_runner_; | 70 scoped_refptr<DomStorageTaskRunner> task_runner_; |
71 scoped_refptr<DomStorageMap> map_; | 71 scoped_refptr<DomStorageMap> map_; |
72 scoped_ptr<DomStorageDatabase> backing_; | 72 scoped_ptr<DomStorageDatabase> backing_; |
73 bool initial_import_done_; | 73 bool initial_import_done_; |
74 ValuesMap changed_values_; | 74 ValuesMap changed_values_; |
75 bool clear_all_next_commit_; | 75 bool clear_all_next_commit_; |
76 bool commit_in_flight_; | 76 bool commit_in_flight_; |
77 }; | 77 }; |
78 | 78 |
79 } // namespace dom_storage | 79 } // namespace dom_storage |
80 | 80 |
81 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ | 81 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
OLD | NEW |