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

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

Issue 9695013: DOMStorageContextImpl that's implemented in terms of the new dom_storage classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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_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/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/nullable_string16.h" 12 #include "base/nullable_string16.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "webkit/dom_storage/dom_storage_database.h" 15 #include "webkit/dom_storage/dom_storage_database.h"
16 #include "webkit/dom_storage/dom_storage_types.h" 16 #include "webkit/dom_storage/dom_storage_types.h"
17 17
18 namespace dom_storage { 18 namespace dom_storage {
19 19
20 class DomStorageMap; 20 class DomStorageMap;
21 class DomStorageTaskRunner; 21 class DomStorageTaskRunner;
22 22
23 // Container for a per-origin Map of key/value pairs potentially 23 // Container for a per-origin Map of key/value pairs potentially
24 // backed by storage on disk and lazily commits changes to disk. 24 // backed by storage on disk and lazily commits changes to disk.
25 // See class comments for DomStorageContext for a larger overview. 25 // See class comments for DomStorageContext for a larger overview.
26 class DomStorageArea 26 class DomStorageArea
27 : public base::RefCountedThreadSafe<DomStorageArea> { 27 : public base::RefCountedThreadSafe<DomStorageArea> {
28 28
29 public: 29 public:
30 static const FilePath::CharType kDatabaseFileExtension[];
31 static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
32
30 DomStorageArea(int64 namespace_id, 33 DomStorageArea(int64 namespace_id,
31 const GURL& origin, 34 const GURL& origin,
32 const FilePath& directory, 35 const FilePath& directory,
33 DomStorageTaskRunner* task_runner); 36 DomStorageTaskRunner* task_runner);
34 37
35 const GURL& origin() const { return origin_; } 38 const GURL& origin() const { return origin_; }
36 int64 namespace_id() const { return namespace_id_; } 39 int64 namespace_id() const { return namespace_id_; }
37 40
38 unsigned Length(); 41 unsigned Length();
39 NullableString16 Key(unsigned index); 42 NullableString16 Key(unsigned index);
(...skipping 13 matching lines...) Expand all
53 56
54 // If we haven't done so already and this is a local storage area, 57 // If we haven't done so already and this is a local storage area,
55 // will attempt to read any values for this origin currently 58 // will attempt to read any values for this origin currently
56 // stored on disk. 59 // stored on disk.
57 void InitialImportIfNeeded(); 60 void InitialImportIfNeeded();
58 61
59 // Posts a task to write the set of changed values to disk. 62 // Posts a task to write the set of changed values to disk.
60 void ScheduleCommitChanges(); 63 void ScheduleCommitChanges();
61 void CommitChanges(); 64 void CommitChanges();
62 65
63 static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
64
65 ~DomStorageArea(); 66 ~DomStorageArea();
66 67
67 int64 namespace_id_; 68 int64 namespace_id_;
68 GURL origin_; 69 GURL origin_;
69 FilePath directory_; 70 FilePath directory_;
70 scoped_refptr<DomStorageTaskRunner> task_runner_; 71 scoped_refptr<DomStorageTaskRunner> task_runner_;
71 scoped_refptr<DomStorageMap> map_; 72 scoped_refptr<DomStorageMap> map_;
72 scoped_ptr<DomStorageDatabase> backing_; 73 scoped_ptr<DomStorageDatabase> backing_;
73 bool initial_import_done_; 74 bool initial_import_done_;
74 ValuesMap changed_values_; 75 ValuesMap changed_values_;
75 bool clear_all_next_commit_; 76 bool clear_all_next_commit_;
76 bool commit_in_flight_; 77 bool commit_in_flight_;
77 }; 78 };
78 79
79 } // namespace dom_storage 80 } // namespace dom_storage
80 81
81 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_ 82 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | webkit/dom_storage/dom_storage_area.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698