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

Unified Diff: webkit/appcache/appcache.cc

Issue 4807001: AppCache: Alter the relative priorities of online vs fallback namespaces. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webkit/appcache/appcache.cc
===================================================================
--- webkit/appcache/appcache.cc (revision 66193)
+++ webkit/appcache/appcache.cc (working copy)
@@ -193,12 +193,20 @@
} else {
url_no_ref = url;
}
+
+ // 6.6.6 Changes to the networking model
+
AppCacheEntry* entry = GetEntry(url_no_ref);
if (entry) {
*found_entry = *entry;
return true;
}
+ if (*found_network_namespace =
+ IsInNetworkNamespace(url_no_ref, online_whitelist_namespaces_)) {
+ return true;
+ }
+
FallbackNamespace* fallback_namespace = FindFallbackNamespace(url_no_ref);
if (fallback_namespace) {
entry = GetEntry(fallback_namespace->second);
@@ -208,7 +216,7 @@
return true;
}
- *found_network_namespace = IsInNetworkNamespace(url_no_ref);
+ *found_network_namespace = online_whitelist_all_;
return *found_network_namespace;
}
@@ -223,18 +231,16 @@
return NULL;
}
-bool AppCache::IsInNetworkNamespace(const GURL& url) {
- if (online_whitelist_all_)
- return true;
-
+// static
+bool AppCache::IsInNetworkNamespace(
+ const GURL& url,
+ const std::vector<GURL> &namespaces) {
// TODO(michaeln): There are certainly better 'prefix matching'
// structures and algorithms that can be applied here and above.
- size_t count = online_whitelist_namespaces_.size();
+ size_t count = namespaces.size();
for (size_t i = 0; i < count; ++i) {
- if (StartsWithASCII(
- url.spec(), online_whitelist_namespaces_[i].spec(), true)) {
+ if (StartsWithASCII( url.spec(), namespaces[i].spec(), true))
kinuko 2010/11/19 00:28:51 nit: extra space before url.spec()
return true;
- }
}
return false;
}

Powered by Google App Engine
This is Rietveld 408576698