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

Side by Side Diff: content/browser/dom_storage/dom_storage_namespace.h

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
7 7
8 #include <stdint.h>
9
8 #include <map> 10 #include <map>
9 #include <string> 11 #include <string>
10 12
11 #include "base/basictypes.h"
12 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 class DOMStorageArea; 20 class DOMStorageArea;
20 class DOMStorageTaskRunner; 21 class DOMStorageTaskRunner;
21 class SessionStorageDatabase; 22 class SessionStorageDatabase;
(...skipping 13 matching lines...) Expand all
35 PURGE_AGGRESSIVE, 36 PURGE_AGGRESSIVE,
36 }; 37 };
37 38
38 // Constructor for a LocalStorage namespace with id of 0 39 // Constructor for a LocalStorage namespace with id of 0
39 // and an optional backing directory on disk. 40 // and an optional backing directory on disk.
40 DOMStorageNamespace(const base::FilePath& directory, // may be empty 41 DOMStorageNamespace(const base::FilePath& directory, // may be empty
41 DOMStorageTaskRunner* task_runner); 42 DOMStorageTaskRunner* task_runner);
42 43
43 // Constructor for a SessionStorage namespace with a non-zero id and an 44 // Constructor for a SessionStorage namespace with a non-zero id and an
44 // optional backing on disk via |session_storage_database| (may be NULL). 45 // optional backing on disk via |session_storage_database| (may be NULL).
45 DOMStorageNamespace(int64 namespace_id, 46 DOMStorageNamespace(int64_t namespace_id,
46 const std::string& persistent_namespace_id, 47 const std::string& persistent_namespace_id,
47 SessionStorageDatabase* session_storage_database, 48 SessionStorageDatabase* session_storage_database,
48 DOMStorageTaskRunner* task_runner); 49 DOMStorageTaskRunner* task_runner);
49 50
50 int64 namespace_id() const { return namespace_id_; } 51 int64_t namespace_id() const { return namespace_id_; }
51 const std::string& persistent_namespace_id() const { 52 const std::string& persistent_namespace_id() const {
52 return persistent_namespace_id_; 53 return persistent_namespace_id_;
53 } 54 }
54 55
55 // Returns the storage area for the given origin, 56 // Returns the storage area for the given origin,
56 // creating instance if needed. Each call to open 57 // creating instance if needed. Each call to open
57 // must be balanced with a call to CloseStorageArea. 58 // must be balanced with a call to CloseStorageArea.
58 DOMStorageArea* OpenStorageArea(const GURL& origin); 59 DOMStorageArea* OpenStorageArea(const GURL& origin);
59 void CloseStorageArea(DOMStorageArea* area); 60 void CloseStorageArea(DOMStorageArea* area);
60 61
61 // Returns the area for |origin| if it's open, otherwise NULL. 62 // Returns the area for |origin| if it's open, otherwise NULL.
62 DOMStorageArea* GetOpenStorageArea(const GURL& origin); 63 DOMStorageArea* GetOpenStorageArea(const GURL& origin);
63 64
64 // Creates a clone of |this| namespace including 65 // Creates a clone of |this| namespace including
65 // shallow copies of all contained areas. 66 // shallow copies of all contained areas.
66 // Should only be called for session storage namespaces. 67 // Should only be called for session storage namespaces.
67 DOMStorageNamespace* Clone(int64 clone_namespace_id, 68 DOMStorageNamespace* Clone(int64_t clone_namespace_id,
68 const std::string& clone_persistent_namespace_id); 69 const std::string& clone_persistent_namespace_id);
69 70
70 void DeleteLocalStorageOrigin(const GURL& origin); 71 void DeleteLocalStorageOrigin(const GURL& origin);
71 void DeleteSessionStorageOrigin(const GURL& origin); 72 void DeleteSessionStorageOrigin(const GURL& origin);
72 void PurgeMemory(PurgeOption purge); 73 void PurgeMemory(PurgeOption purge);
73 void Shutdown(); 74 void Shutdown();
74 void Flush(); 75 void Flush();
75 76
76 unsigned int CountInMemoryAreas() const; 77 unsigned int CountInMemoryAreas() const;
77 78
78 private: 79 private:
79 friend class base::RefCountedThreadSafe<DOMStorageNamespace>; 80 friend class base::RefCountedThreadSafe<DOMStorageNamespace>;
80 81
81 // Struct to hold references to our contained areas and 82 // Struct to hold references to our contained areas and
82 // to keep track of how many tabs have a given area open. 83 // to keep track of how many tabs have a given area open.
83 struct AreaHolder { 84 struct AreaHolder {
84 scoped_refptr<DOMStorageArea> area_; 85 scoped_refptr<DOMStorageArea> area_;
85 int open_count_; 86 int open_count_;
86 AreaHolder(); 87 AreaHolder();
87 AreaHolder(DOMStorageArea* area, int count); 88 AreaHolder(DOMStorageArea* area, int count);
88 ~AreaHolder(); 89 ~AreaHolder();
89 }; 90 };
90 typedef std::map<GURL, AreaHolder> AreaMap; 91 typedef std::map<GURL, AreaHolder> AreaMap;
91 92
92 ~DOMStorageNamespace(); 93 ~DOMStorageNamespace();
93 94
94 // Returns a pointer to the area holder in our map or NULL. 95 // Returns a pointer to the area holder in our map or NULL.
95 AreaHolder* GetAreaHolder(const GURL& origin); 96 AreaHolder* GetAreaHolder(const GURL& origin);
96 97
97 int64 namespace_id_; 98 int64_t namespace_id_;
98 std::string persistent_namespace_id_; 99 std::string persistent_namespace_id_;
99 base::FilePath directory_; 100 base::FilePath directory_;
100 AreaMap areas_; 101 AreaMap areas_;
101 scoped_refptr<DOMStorageTaskRunner> task_runner_; 102 scoped_refptr<DOMStorageTaskRunner> task_runner_;
102 scoped_refptr<SessionStorageDatabase> session_storage_database_; 103 scoped_refptr<SessionStorageDatabase> session_storage_database_;
103 }; 104 };
104 105
105 } // namespace content 106 } // namespace content
106 107
107 108
108 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_ 109 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_message_filter.cc ('k') | content/browser/dom_storage/dom_storage_namespace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698