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

Side by Side Diff: webkit/appcache/appcache.h

Issue 8949001: Fix some loose ends around recently introduced AppCache INTERCEPT namespaces (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « no previous file | webkit/appcache/appcache.cc » ('j') | webkit/appcache/appcache_storage.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_APPCACHE_APPCACHE_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_H_
6 #define WEBKIT_APPCACHE_APPCACHE_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // Removes an entry from the EntryMap, the URL must be in the set. 54 // Removes an entry from the EntryMap, the URL must be in the set.
55 void RemoveEntry(const GURL& url); 55 void RemoveEntry(const GURL& url);
56 56
57 // Do not store the returned object as it could be deleted anytime. 57 // Do not store the returned object as it could be deleted anytime.
58 AppCacheEntry* GetEntry(const GURL& url); 58 AppCacheEntry* GetEntry(const GURL& url);
59 const AppCacheEntry* GetEntryWithResponseId(int64 response_id); 59 const AppCacheEntry* GetEntryWithResponseId(int64 response_id);
60 60
61 const EntryMap& entries() const { return entries_; } 61 const EntryMap& entries() const { return entries_; }
62 62
63 // Returns the URL of the resource used as the fallback for 'namespace_url'. 63 // Returns the URL of the resource used as entry for 'namespace_url'.
64 GURL GetFallbackEntryUrl(const GURL& namespace_url) const; 64 GURL GetFallbackEntryUrl(const GURL& namespace_url) const {
65 return GetNamespaceEntryUrl(fallback_namespaces_, namespace_url);
66 }
67 GURL GetInterceptEntryUrl(const GURL& namespace_url) const {
68 return GetNamespaceEntryUrl(intercept_namespaces_, namespace_url);
69 }
65 70
66 AppCacheHosts& associated_hosts() { return associated_hosts_; } 71 AppCacheHosts& associated_hosts() { return associated_hosts_; }
67 72
68 bool IsNewerThan(AppCache* cache) const { 73 bool IsNewerThan(AppCache* cache) const {
69 // TODO(michaeln): revisit, the system clock can be set 74 // TODO(michaeln): revisit, the system clock can be set
70 // back in time which would confuse this logic. 75 // back in time which would confuse this logic.
71 if (update_time_ > cache->update_time_) 76 if (update_time_ > cache->update_time_)
72 return true; 77 return true;
73 78
74 // Tie breaker. Newer caches have a larger cache ID. 79 // Tie breaker. Newer caches have a larger cache ID.
(...skipping 25 matching lines...) Expand all
100 // to represent this cache. 105 // to represent this cache.
101 void ToDatabaseRecords( 106 void ToDatabaseRecords(
102 const AppCacheGroup* group, 107 const AppCacheGroup* group,
103 AppCacheDatabase::CacheRecord* cache_record, 108 AppCacheDatabase::CacheRecord* cache_record,
104 std::vector<AppCacheDatabase::EntryRecord>* entries, 109 std::vector<AppCacheDatabase::EntryRecord>* entries,
105 std::vector<AppCacheDatabase::NamespaceRecord>* intercepts, 110 std::vector<AppCacheDatabase::NamespaceRecord>* intercepts,
106 std::vector<AppCacheDatabase::NamespaceRecord>* fallbacks, 111 std::vector<AppCacheDatabase::NamespaceRecord>* fallbacks,
107 std::vector<AppCacheDatabase::OnlineWhiteListRecord>* whitelists); 112 std::vector<AppCacheDatabase::OnlineWhiteListRecord>* whitelists);
108 113
109 bool FindResponseForRequest(const GURL& url, 114 bool FindResponseForRequest(const GURL& url,
110 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, 115 AppCacheEntry* found_entry, GURL* found_intercept_namespace,
111 GURL* found_fallback_namespace, bool* found_network_namespace); 116 AppCacheEntry* found_fallback_entry, GURL* found_fallback_namespace,
117 bool* found_network_namespace);
112 118
113 // Populates the 'infos' vector with an element per entry in the appcache. 119 // Populates the 'infos' vector with an element per entry in the appcache.
114 void ToResourceInfoVector(AppCacheResourceInfoVector* infos) const; 120 void ToResourceInfoVector(AppCacheResourceInfoVector* infos) const;
115 121
116 static bool IsInNetworkNamespace( 122 static bool IsInNetworkNamespace(
117 const GURL& url, 123 const GURL& url,
118 const std::vector<GURL> &namespaces); 124 const std::vector<GURL> &namespaces);
119 125
120 private: 126 private:
121 friend class AppCacheGroup; 127 friend class AppCacheGroup;
(...skipping 10 matching lines...) Expand all
132 // FindResponseForRequest helpers 138 // FindResponseForRequest helpers
133 const Namespace* FindInterceptNamespace(const GURL& url) { 139 const Namespace* FindInterceptNamespace(const GURL& url) {
134 return FindNamespace(intercept_namespaces_, url); 140 return FindNamespace(intercept_namespaces_, url);
135 } 141 }
136 const Namespace* FindFallbackNamespace(const GURL& url) { 142 const Namespace* FindFallbackNamespace(const GURL& url) {
137 return FindNamespace(fallback_namespaces_, url); 143 return FindNamespace(fallback_namespaces_, url);
138 } 144 }
139 const Namespace* FindNamespace(const NamespaceVector& namespaces, 145 const Namespace* FindNamespace(const NamespaceVector& namespaces,
140 const GURL& url); 146 const GURL& url);
141 147
148 GURL GetNamespaceEntryUrl(const NamespaceVector& namespaces,
149 const GURL& namespace_url) const;
150
142 // Use AppCacheHost::Associate*Cache() to manipulate host association. 151 // Use AppCacheHost::Associate*Cache() to manipulate host association.
143 void AssociateHost(AppCacheHost* host) { 152 void AssociateHost(AppCacheHost* host) {
144 associated_hosts_.insert(host); 153 associated_hosts_.insert(host);
145 } 154 }
146 void UnassociateHost(AppCacheHost* host); 155 void UnassociateHost(AppCacheHost* host);
147 156
148 const int64 cache_id_; 157 const int64 cache_id_;
149 scoped_refptr<AppCacheGroup> owning_group_; 158 scoped_refptr<AppCacheGroup> owning_group_;
150 AppCacheHosts associated_hosts_; 159 AppCacheHosts associated_hosts_;
151 160
(...skipping 15 matching lines...) Expand all
167 AppCacheService* service_; 176 AppCacheService* service_;
168 177
169 FRIEND_TEST_ALL_PREFIXES(AppCacheTest, InitializeWithManifest); 178 FRIEND_TEST_ALL_PREFIXES(AppCacheTest, InitializeWithManifest);
170 179
171 DISALLOW_COPY_AND_ASSIGN(AppCache); 180 DISALLOW_COPY_AND_ASSIGN(AppCache);
172 }; 181 };
173 182
174 } // namespace appcache 183 } // namespace appcache
175 184
176 #endif // WEBKIT_APPCACHE_APPCACHE_H_ 185 #endif // WEBKIT_APPCACHE_APPCACHE_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/appcache/appcache.cc » ('j') | webkit/appcache/appcache_storage.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698