| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ | 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // specifics of responsibilities are fairly well documented here and in | 23 // specifics of responsibilities are fairly well documented here and in |
| 24 // StorageNamespace and StorageArea. Everything is only to be accessed on the | 24 // StorageNamespace and StorageArea. Everything is only to be accessed on the |
| 25 // WebKit thread unless noted otherwise. | 25 // WebKit thread unless noted otherwise. |
| 26 // | 26 // |
| 27 // NOTE: Virtual methods facilitate mocking functions for testing. | 27 // NOTE: Virtual methods facilitate mocking functions for testing. |
| 28 class DOMStorageContext { | 28 class DOMStorageContext { |
| 29 public: | 29 public: |
| 30 explicit DOMStorageContext(WebKitContext* webkit_context); | 30 explicit DOMStorageContext(WebKitContext* webkit_context); |
| 31 virtual ~DOMStorageContext(); | 31 virtual ~DOMStorageContext(); |
| 32 | 32 |
| 33 // Invalid storage id. No storage session will ever report this value. |
| 34 // Used in DOMStorageMessageFilter::OnStorageAreaId when coping with |
| 35 // interactions with non-existent storage sessions. |
| 36 static const int64 kInvalidStorageId = -1; |
| 37 |
| 33 // Allocate a new storage area id. Only call on the WebKit thread. | 38 // Allocate a new storage area id. Only call on the WebKit thread. |
| 34 int64 AllocateStorageAreaId(); | 39 int64 AllocateStorageAreaId(); |
| 35 | 40 |
| 36 // Allocate a new session storage id. Only call on the UI or IO thread. | 41 // Allocate a new session storage id. Only call on the UI or IO thread. |
| 37 int64 AllocateSessionStorageNamespaceId(); | 42 int64 AllocateSessionStorageNamespaceId(); |
| 38 | 43 |
| 39 // Clones a session storage namespace and returns the cloned namespaces' id. | 44 // Clones a session storage namespace and returns the cloned namespaces' id. |
| 40 // Only call on the IO thread. | 45 // Only call on the IO thread. |
| 41 int64 CloneSessionStorage(int64 original_id); | 46 int64 CloneSessionStorage(int64 original_id); |
| 42 | 47 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 StorageAreaMap storage_area_map_; | 148 StorageAreaMap storage_area_map_; |
| 144 | 149 |
| 145 // Maps ids to StorageNamespaces. We own these objects. | 150 // Maps ids to StorageNamespaces. We own these objects. |
| 146 typedef std::map<int64, DOMStorageNamespace*> StorageNamespaceMap; | 151 typedef std::map<int64, DOMStorageNamespace*> StorageNamespaceMap; |
| 147 StorageNamespaceMap storage_namespace_map_; | 152 StorageNamespaceMap storage_namespace_map_; |
| 148 | 153 |
| 149 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContext); | 154 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContext); |
| 150 }; | 155 }; |
| 151 | 156 |
| 152 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ | 157 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_CONTEXT_H_ |
| OLD | NEW |