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

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

Issue 192043: AppCacheHost cache selection algorithm (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | « webkit/appcache/appcache_service.h ('k') | webkit/appcache/appcache_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/appcache/appcache_service.h" 5 #include "webkit/appcache/appcache_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/ref_counted.h"
8 #include "webkit/appcache/appcache.h" 9 #include "webkit/appcache/appcache.h"
9 #include "webkit/appcache/appcache_backend_impl.h" 10 #include "webkit/appcache/appcache_backend_impl.h"
11 #include "webkit/appcache/appcache_entry.h"
10 #include "webkit/appcache/appcache_group.h" 12 #include "webkit/appcache/appcache_group.h"
11 13
12 namespace appcache { 14 namespace appcache {
13 15
14 AppCacheService::AppCacheService() 16 AppCacheService::AppCacheService()
15 : last_cache_id_(0), last_group_id_(0), 17 : last_cache_id_(0), last_group_id_(0),
16 last_entry_id_(0), last_response_id_(0) { 18 last_entry_id_(0), last_response_id_(0) {
17 } 19 }
18 20
19 AppCacheService::~AppCacheService() { 21 AppCacheService::~AppCacheService() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void AppCacheService::AddGroup(AppCacheGroup* group) { 55 void AppCacheService::AddGroup(AppCacheGroup* group) {
54 const GURL& url = group->manifest_url(); 56 const GURL& url = group->manifest_url();
55 DCHECK(groups_.find(url) == groups_.end()); 57 DCHECK(groups_.find(url) == groups_.end());
56 groups_.insert(GroupMap::value_type(url, group)); 58 groups_.insert(GroupMap::value_type(url, group));
57 } 59 }
58 60
59 void AppCacheService::RemoveGroup(AppCacheGroup* group) { 61 void AppCacheService::RemoveGroup(AppCacheGroup* group) {
60 groups_.erase(group->manifest_url()); 62 groups_.erase(group->manifest_url());
61 } 63 }
62 64
65 void AppCacheService::LoadCache(int64 id, LoadClient* client) {
66 // TODO(michaeln): actually retrieve from storage if needed
67 client->CacheLoadedCallback(GetCache(id), id);
68 }
69
70 void AppCacheService::LoadOrCreateGroup(const GURL& manifest_url,
71 LoadClient* client) {
72 // TODO(michaeln): actually retrieve from storage
73 scoped_refptr<AppCacheGroup> group = GetGroup(manifest_url);
74 if (!group.get()) {
75 group = new AppCacheGroup(this, manifest_url);
76 DCHECK(GetGroup(manifest_url));
77 }
78 client->GroupLoadedCallback(group.get(), manifest_url);
79 }
80
81 void AppCacheService::CancelLoads(LoadClient* client) {
82 // TODO(michaeln): remove client from loading lists
83 }
84
85 void AppCacheService::MarkAsForeignEntry(const GURL& entry_url,
86 int64 cache_id) {
87 // Update the in-memory cache.
88 AppCache* cache = GetCache(cache_id);
89 if (cache) {
90 AppCacheEntry* entry = cache->GetEntry(entry_url);
91 DCHECK(entry);
92 if (entry)
93 entry->add_types(AppCacheEntry::FOREIGN);
94 }
95
96 // TODO(michaeln): actually update in storage, and if this cache is
97 // being loaded be sure to update the memory cache upon load completion.
98 }
99
63 } // namespace appcache 100 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_service.h ('k') | webkit/appcache/appcache_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698