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 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/nullable_string16.h" | 11 #include "base/nullable_string16.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "webkit/dom_storage/dom_storage_database.h" | |
|
michaeln
2012/02/14 06:39:26
instead of directly including, i think this could
benm (inactive)
2012/02/14 11:12:07
I think it needs to be #included as it's used in a
| |
| 14 #include "webkit/dom_storage/dom_storage_task_runner.h" | 15 #include "webkit/dom_storage/dom_storage_task_runner.h" |
| 15 | 16 |
| 16 class FilePath; | 17 class FilePath; |
| 17 class GURL; | 18 class GURL; |
| 18 | 19 |
| 19 namespace dom_storage { | 20 namespace dom_storage { |
| 20 | 21 |
| 21 class DomStorageMap; | 22 class DomStorageMap; |
| 22 | 23 |
| 23 // Container for a per-origin Map of key/value pairs potentially | 24 // Container for a per-origin Map of key/value pairs potentially |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 40 NullableString16 GetItem(const string16& key); | 41 NullableString16 GetItem(const string16& key); |
| 41 bool SetItem(const string16& key, const string16& value, | 42 bool SetItem(const string16& key, const string16& value, |
| 42 NullableString16* old_value); | 43 NullableString16* old_value); |
| 43 bool RemoveItem(const string16& key, string16* old_value); | 44 bool RemoveItem(const string16& key, string16* old_value); |
| 44 bool Clear(); | 45 bool Clear(); |
| 45 | 46 |
| 46 DomStorageArea* ShallowCopy(int64 destination_namespace_id); | 47 DomStorageArea* ShallowCopy(int64 destination_namespace_id); |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics); | 50 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DomStorageAreaBasics); |
| 51 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); | |
| 52 FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, TestDatabaseFilePath); | |
| 50 friend class base::RefCountedThreadSafe<DomStorageArea>; | 53 friend class base::RefCountedThreadSafe<DomStorageArea>; |
| 51 | 54 |
| 55 void InitialImportIfNeeded(); | |
| 56 void SyncToBacking(); | |
|
michaeln
2012/02/14 06:39:26
should we stick with the CommitChanges terminology
benm (inactive)
2012/02/14 11:12:07
Done.
| |
| 57 | |
| 58 static FilePath DatabaseFileNameFromOrigin(const GURL& origin); | |
| 59 | |
| 52 ~DomStorageArea(); | 60 ~DomStorageArea(); |
| 53 | 61 |
| 54 int64 namespace_id_; | 62 int64 namespace_id_; |
| 55 GURL origin_; | 63 GURL origin_; |
| 56 FilePath directory_; | 64 FilePath directory_; |
| 57 scoped_refptr<DomStorageTaskRunner> task_runner_; | 65 scoped_refptr<DomStorageTaskRunner> task_runner_; |
| 58 scoped_refptr<DomStorageMap> map_; | 66 scoped_refptr<DomStorageMap> map_; |
| 59 // TODO(benm): integrate with DomStorageDatabase to read from | 67 scoped_ptr<DomStorageDatabase> backing_; |
| 60 // and lazily write to disk. | 68 bool initial_import_done_; |
| 69 ValuesMap items_to_sync_; | |
|
michaeln
2012/02/14 06:39:26
if switching terminology, changed_values_?
benm (inactive)
2012/02/14 11:12:07
Done.
| |
| 70 bool clear_all_next_sync_; | |
| 61 }; | 71 }; |
| 62 | 72 |
| 63 } // namespace dom_storage | 73 } // namespace dom_storage |
| 64 | 74 |
| 65 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ | 75 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ |
| OLD | NEW |