OLD | NEW |
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 #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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // Always make this operation look async. | 77 // Always make this operation look async. |
78 ScheduleTask(method_factory_.NewRunnableMethod( | 78 ScheduleTask(method_factory_.NewRunnableMethod( |
79 &MockAppCacheStorage::ProcessStoreGroupAndNewestCache, | 79 &MockAppCacheStorage::ProcessStoreGroupAndNewestCache, |
80 make_scoped_refptr(group), | 80 make_scoped_refptr(group), |
81 make_scoped_refptr(newest_cache), | 81 make_scoped_refptr(newest_cache), |
82 make_scoped_refptr(GetOrCreateDelegateReference(delegate)))); | 82 make_scoped_refptr(GetOrCreateDelegateReference(delegate)))); |
83 } | 83 } |
84 | 84 |
85 void MockAppCacheStorage::FindResponseForMainRequest( | 85 void MockAppCacheStorage::FindResponseForMainRequest( |
86 const GURL& url, Delegate* delegate) { | 86 const GURL& url, const GURL& preferred_manifest_url, Delegate* delegate) { |
87 DCHECK(delegate); | 87 DCHECK(delegate); |
88 | 88 |
| 89 // Note: MockAppCacheStorage does not respect the preferred_manifest_url. |
| 90 |
89 // Always make this operation look async. | 91 // Always make this operation look async. |
90 ScheduleTask(method_factory_.NewRunnableMethod( | 92 ScheduleTask(method_factory_.NewRunnableMethod( |
91 &MockAppCacheStorage::ProcessFindResponseForMainRequest, | 93 &MockAppCacheStorage::ProcessFindResponseForMainRequest, |
92 url, | 94 url, |
93 make_scoped_refptr(GetOrCreateDelegateReference(delegate)))); | 95 make_scoped_refptr(GetOrCreateDelegateReference(delegate)))); |
94 } | 96 } |
95 | 97 |
96 void MockAppCacheStorage::FindResponseForSubRequest( | 98 void MockAppCacheStorage::FindResponseForSubRequest( |
97 AppCache* cache, const GURL& url, | 99 AppCache* cache, const GURL& url, |
98 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, | 100 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { | 468 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { |
467 if (!cache) | 469 if (!cache) |
468 return true; | 470 return true; |
469 | 471 |
470 // If the 'stored' ref is the only ref, real storage will have to load from | 472 // If the 'stored' ref is the only ref, real storage will have to load from |
471 // the database. | 473 // the database. |
472 return IsCacheStored(cache) && cache->HasOneRef(); | 474 return IsCacheStored(cache) && cache->HasOneRef(); |
473 } | 475 } |
474 | 476 |
475 } // namespace appcache | 477 } // namespace appcache |
OLD | NEW |