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

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

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_
6 #define WEBKIT_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_
7 #pragma once
8
9 #include "webkit/dom_storage/dom_storage_database.h"
10
11 namespace leveldb {
12 struct DB;
13 }
14
15 namespace dom_storage {
16
17 // All DomStorageAreas for session storage share the same
18 // SessionStorageDatabase.
19 class SessionStorageDatabase : public DomStorageDatabase {
20 public:
21 explicit SessionStorageDatabase(const FilePath& file_path);
22 virtual ~SessionStorageDatabase();
23
24 // Reads all the key, value pairs stored in the database and returns
25 // them. |result| is assumed to be empty and any duplicate keys will
26 // be overwritten. If the database exists on disk then it will be
27 // opened. If it does not exist then it will not be created and
28 // |result| will be unmodified.
29 virtual void ReadAllValues(int64 namespace_id,
michaeln 2012/04/03 22:56:45 This pre-existing interface borrowed from localsto
marja 2012/04/10 15:34:45 Yes, I added ShallowCopy() and DeepCopy() here. Bu
30 const GURL& origin,
31 ValuesMap* result) OVERRIDE;
32
33 // Updates the backing database. Will remove all keys before updating
34 // the database if |clear_all_first| is set. Then all entries in
35 // |changes| will be examined - keys mapped to a null NullableString16
36 // will be removed and all others will be inserted/updated as appropriate.
37 virtual bool CommitChanges(int64 namespace_id,
38 const GURL& origin,
39 bool clear_all_first,
40 const ValuesMap& changes) OVERRIDE;
41 private:
42 virtual bool LazyOpen(bool create_if_needed);
43 virtual bool IsOpen() const;
44
45 // Helper for reading all values belonging to the map |map_id| into |result|.
46 void ReadAllValuesInMap(const std::string map_id, ValuesMap* result);
47
48 scoped_ptr<leveldb::DB> db_;
49 };
50
51 } // namespace dom_storage
52
53 #endif // WEBKIT_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698