| 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_CACHED_AREA_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_CACHED_AREA_H_ |
| 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_CACHED_AREA_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_CACHED_AREA_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/nullable_string16.h" | 12 #include "base/nullable_string16.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "webkit/dom_storage/dom_storage_export.h" |
| 14 | 15 |
| 15 namespace dom_storage { | 16 namespace dom_storage { |
| 16 | 17 |
| 17 class DomStorageMap; | 18 class DomStorageMap; |
| 18 class DomStorageProxy; | 19 class DomStorageProxy; |
| 19 | 20 |
| 20 // Unlike the other classes in the dom_storage library, this one is intended | 21 // Unlike the other classes in the dom_storage library, this one is intended |
| 21 // for use in renderer processes. It maintains a complete cache of the | 22 // for use in renderer processes. It maintains a complete cache of the |
| 22 // origin's Map of key/value pairs for fast access. The cache is primed on | 23 // origin's Map of key/value pairs for fast access. The cache is primed on |
| 23 // first access and changes are written to the backend thru the |proxy|. | 24 // first access and changes are written to the backend thru the |proxy|. |
| 24 // Mutations originating in other processes are applied to the cache via | 25 // Mutations originating in other processes are applied to the cache via |
| 25 // the ApplyMutation method. | 26 // the ApplyMutation method. |
| 26 class DomStorageCachedArea : public base::RefCounted<DomStorageCachedArea> { | 27 class DOM_STORAGE_EXPORT DomStorageCachedArea : |
| 28 public base::RefCounted<DomStorageCachedArea> { |
| 27 public: | 29 public: |
| 28 DomStorageCachedArea(int64 namespace_id, const GURL& origin, | 30 DomStorageCachedArea(int64 namespace_id, const GURL& origin, |
| 29 DomStorageProxy* proxy); | 31 DomStorageProxy* proxy); |
| 30 | 32 |
| 31 int64 namespace_id() const { return namespace_id_; } | 33 int64 namespace_id() const { return namespace_id_; } |
| 32 const GURL& origin() const { return origin_; } | 34 const GURL& origin() const { return origin_; } |
| 33 | 35 |
| 34 unsigned GetLength(int connection_id); | 36 unsigned GetLength(int connection_id); |
| 35 NullableString16 GetKey(int connection_id, unsigned index); | 37 NullableString16 GetKey(int connection_id, unsigned index); |
| 36 NullableString16 GetItem(int connection_id, const string16& key); | 38 NullableString16 GetItem(int connection_id, const string16& key); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int64 namespace_id_; | 81 int64 namespace_id_; |
| 80 GURL origin_; | 82 GURL origin_; |
| 81 scoped_refptr<DomStorageMap> map_; | 83 scoped_refptr<DomStorageMap> map_; |
| 82 scoped_refptr<DomStorageProxy> proxy_; | 84 scoped_refptr<DomStorageProxy> proxy_; |
| 83 base::WeakPtrFactory<DomStorageCachedArea> weak_factory_; | 85 base::WeakPtrFactory<DomStorageCachedArea> weak_factory_; |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace dom_storage | 88 } // namespace dom_storage |
| 87 | 89 |
| 88 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CACHED_AREA_H_ | 90 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_CACHED_AREA_H_ |
| OLD | NEW |