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

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

Issue 3529009: Fix http/tests/appcache/foreign-fallback.html (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "webkit/appcache/appcache.h" 7 #include "webkit/appcache/appcache.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DCHECK(found != entries_.end()); 63 DCHECK(found != entries_.end());
64 cache_size_ -= found->second.response_size(); 64 cache_size_ -= found->second.response_size();
65 entries_.erase(found); 65 entries_.erase(found);
66 } 66 }
67 67
68 AppCacheEntry* AppCache::GetEntry(const GURL& url) { 68 AppCacheEntry* AppCache::GetEntry(const GURL& url) {
69 EntryMap::iterator it = entries_.find(url); 69 EntryMap::iterator it = entries_.find(url);
70 return (it != entries_.end()) ? &(it->second) : NULL; 70 return (it != entries_.end()) ? &(it->second) : NULL;
71 } 71 }
72 72
73 GURL AppCache::GetFallbackEntryUrl(const GURL& namespace_url) const {
74 size_t count = fallback_namespaces_.size();
75 for (size_t i = 0; i < count; ++i) {
76 if (fallback_namespaces_[i].first == namespace_url)
77 return fallback_namespaces_[i].second;
78 }
79 NOTREACHED();
80 return GURL();
81 }
82
73 namespace { 83 namespace {
74 bool SortByLength( 84 bool SortByLength(
75 const FallbackNamespace& lhs, const FallbackNamespace& rhs) { 85 const FallbackNamespace& lhs, const FallbackNamespace& rhs) {
76 return lhs.first.spec().length() > rhs.first.spec().length(); 86 return lhs.first.spec().length() > rhs.first.spec().length();
77 } 87 }
78 } 88 }
79 89
80 void AppCache::InitializeWithManifest(Manifest* manifest) { 90 void AppCache::InitializeWithManifest(Manifest* manifest) {
81 DCHECK(manifest); 91 DCHECK(manifest);
82 fallback_namespaces_.swap(manifest->fallback_namespaces); 92 fallback_namespaces_.swap(manifest->fallback_namespaces);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 for (size_t i = 0; i < count; ++i) { 233 for (size_t i = 0; i < count; ++i) {
224 if (StartsWithASCII( 234 if (StartsWithASCII(
225 url.spec(), online_whitelist_namespaces_[i].spec(), true)) { 235 url.spec(), online_whitelist_namespaces_[i].spec(), true)) {
226 return true; 236 return true;
227 } 237 }
228 } 238 }
229 return false; 239 return false;
230 } 240 }
231 241
232 } // namespace appcache 242 } // namespace appcache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698