| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/mock_appcache_storage.h" | 5 #include "webkit/appcache/mock_appcache_storage.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 void MockAppCacheStorage::ProcessLoadCache( | 165 void MockAppCacheStorage::ProcessLoadCache( |
| 166 int64 id, scoped_refptr<DelegateReference> delegate_ref) { | 166 int64 id, scoped_refptr<DelegateReference> delegate_ref) { |
| 167 AppCache* cache = working_set_.GetCache(id); | 167 AppCache* cache = working_set_.GetCache(id); |
| 168 if (delegate_ref->delegate) | 168 if (delegate_ref->delegate) |
| 169 delegate_ref->delegate->OnCacheLoaded(cache, id); | 169 delegate_ref->delegate->OnCacheLoaded(cache, id); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void MockAppCacheStorage::ProcessLoadOrCreateGroup( | 172 void MockAppCacheStorage::ProcessLoadOrCreateGroup( |
| 173 const GURL& manifest_url, scoped_refptr<DelegateReference> delegate_ref) { | 173 const GURL& manifest_url, scoped_refptr<DelegateReference> delegate_ref) { |
| 174 scoped_refptr<AppCacheGroup> group = working_set_.GetGroup(manifest_url); | 174 scoped_refptr<AppCacheGroup> group(working_set_.GetGroup(manifest_url)); |
| 175 | 175 |
| 176 // Newly created groups are not put in the stored_groups collection | 176 // Newly created groups are not put in the stored_groups collection |
| 177 // until StoreGroupAndNewestCache is called. | 177 // until StoreGroupAndNewestCache is called. |
| 178 if (!group) | 178 if (!group) |
| 179 group = new AppCacheGroup(service_, manifest_url, NewGroupId()); | 179 group = new AppCacheGroup(service_, manifest_url, NewGroupId()); |
| 180 | 180 |
| 181 if (delegate_ref->delegate) | 181 if (delegate_ref->delegate) |
| 182 delegate_ref->delegate->OnGroupLoaded(group, manifest_url); | 182 delegate_ref->delegate->OnGroupLoaded(group, manifest_url); |
| 183 } | 183 } |
| 184 | 184 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { | 455 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { |
| 456 if (!cache) | 456 if (!cache) |
| 457 return true; | 457 return true; |
| 458 | 458 |
| 459 // If the 'stored' ref is the only ref, real storage will have to load from | 459 // If the 'stored' ref is the only ref, real storage will have to load from |
| 460 // the database. | 460 // the database. |
| 461 return IsCacheStored(cache) && cache->HasOneRef(); | 461 return IsCacheStored(cache) && cache->HasOneRef(); |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace appcache | 464 } // namespace appcache |
| OLD | NEW |