Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: webkit/dom_storage/dom_storage_namespace.h

Issue 12398008: Purge in-memory localStorage areas if the # of areas exceeds the limit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_NAMESPACE_H_ 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 DomStorageArea* GetOpenStorageArea(const GURL& origin); 52 DomStorageArea* GetOpenStorageArea(const GURL& origin);
53 53
54 // Creates a clone of |this| namespace including 54 // Creates a clone of |this| namespace including
55 // shallow copies of all contained areas. 55 // shallow copies of all contained areas.
56 // Should only be called for session storage namespaces. 56 // Should only be called for session storage namespaces.
57 DomStorageNamespace* Clone(int64 clone_namespace_id, 57 DomStorageNamespace* Clone(int64 clone_namespace_id,
58 const std::string& clone_persistent_namespace_id); 58 const std::string& clone_persistent_namespace_id);
59 59
60 void DeleteLocalStorageOrigin(const GURL& origin); 60 void DeleteLocalStorageOrigin(const GURL& origin);
61 void DeleteSessionStorageOrigin(const GURL& origin); 61 void DeleteSessionStorageOrigin(const GURL& origin);
62 void PurgeUnopenedAreas();
62 void PurgeMemory(); 63 void PurgeMemory();
63 void Shutdown(); 64 void Shutdown();
64 65
66 unsigned int CountInMemoryAreas() const { return areas_.size(); }
michaeln 2013/04/05 23:39:23 Unfortunately, I don't think this is an accurate c
kinuko 2013/04/10 07:04:14 Good point, I changed the code to iterate over are
67
65 private: 68 private:
66 friend class base::RefCountedThreadSafe<DomStorageNamespace>; 69 friend class base::RefCountedThreadSafe<DomStorageNamespace>;
67 70
68 // Struct to hold references to our contained areas and 71 // Struct to hold references to our contained areas and
69 // to keep track of how many tabs have a given area open. 72 // to keep track of how many tabs have a given area open.
70 struct AreaHolder { 73 struct AreaHolder {
71 scoped_refptr<DomStorageArea> area_; 74 scoped_refptr<DomStorageArea> area_;
72 int open_count_; 75 int open_count_;
73 AreaHolder(); 76 AreaHolder();
74 AreaHolder(DomStorageArea* area, int count); 77 AreaHolder(DomStorageArea* area, int count);
(...skipping 11 matching lines...) Expand all
86 base::FilePath directory_; 89 base::FilePath directory_;
87 AreaMap areas_; 90 AreaMap areas_;
88 scoped_refptr<DomStorageTaskRunner> task_runner_; 91 scoped_refptr<DomStorageTaskRunner> task_runner_;
89 scoped_refptr<SessionStorageDatabase> session_storage_database_; 92 scoped_refptr<SessionStorageDatabase> session_storage_database_;
90 }; 93 };
91 94
92 } // namespace dom_storage 95 } // namespace dom_storage
93 96
94 97
95 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 98 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698