| 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 "content/browser/appcache/appcache_backend_impl.h" | 5 #include "content/browser/appcache/appcache_backend_impl.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "content/browser/appcache/appcache.h" | 8 #include "content/browser/appcache/appcache.h" |
| 9 #include "content/browser/appcache/appcache_group.h" | 9 #include "content/browser/appcache/appcache_group.h" |
| 10 #include "content/browser/appcache/appcache_service_impl.h" | 10 #include "content/browser/appcache/appcache_service_impl.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 host->SetSpawningHostId(process_id_, spawning_host_id); | 61 host->SetSpawningHostId(process_id_, spawning_host_id); |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool AppCacheBackendImpl::SelectCache( | 65 bool AppCacheBackendImpl::SelectCache( |
| 66 int host_id, | 66 int host_id, |
| 67 const GURL& document_url, | 67 const GURL& document_url, |
| 68 const int64 cache_document_was_loaded_from, | 68 const int64 cache_document_was_loaded_from, |
| 69 const GURL& manifest_url) { | 69 const GURL& manifest_url) { |
| 70 AppCacheHost* host = GetHost(host_id); | 70 AppCacheHost* host = GetHost(host_id); |
| 71 if (!host) | 71 if (!host || host->was_select_cache_called()) |
| 72 return false; | 72 return false; |
| 73 | 73 |
| 74 host->SelectCache(document_url, cache_document_was_loaded_from, | 74 host->SelectCache(document_url, cache_document_was_loaded_from, |
| 75 manifest_url); | 75 manifest_url); |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool AppCacheBackendImpl::SelectCacheForWorker( | 79 bool AppCacheBackendImpl::SelectCacheForWorker( |
| 80 int host_id, int parent_process_id, int parent_host_id) { | 80 int host_id, int parent_process_id, int parent_host_id) { |
| 81 AppCacheHost* host = GetHost(host_id); | 81 AppCacheHost* host = GetHost(host_id); |
| 82 if (!host) | 82 if (!host || host->was_select_cache_called()) |
| 83 return false; | 83 return false; |
| 84 | 84 |
| 85 host->SelectCacheForWorker(parent_process_id, parent_host_id); | 85 host->SelectCacheForWorker(parent_process_id, parent_host_id); |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool AppCacheBackendImpl::SelectCacheForSharedWorker( | 89 bool AppCacheBackendImpl::SelectCacheForSharedWorker( |
| 90 int host_id, int64 appcache_id) { | 90 int host_id, int64 appcache_id) { |
| 91 AppCacheHost* host = GetHost(host_id); | 91 AppCacheHost* host = GetHost(host_id); |
| 92 if (!host) | 92 if (!host || host->was_select_cache_called()) |
| 93 return false; | 93 return false; |
| 94 | 94 |
| 95 host->SelectCacheForSharedWorker(appcache_id); | 95 host->SelectCacheForSharedWorker(appcache_id); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool AppCacheBackendImpl::MarkAsForeignEntry( | 99 bool AppCacheBackendImpl::MarkAsForeignEntry( |
| 100 int host_id, | 100 int host_id, |
| 101 const GURL& document_url, | 101 const GURL& document_url, |
| 102 int64 cache_document_was_loaded_from) { | 102 int64 cache_document_was_loaded_from) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 delete found->second; | 175 delete found->second; |
| 176 | 176 |
| 177 // We take onwership. | 177 // We take onwership. |
| 178 host->CompleteTransfer(new_host_id, frontend_); | 178 host->CompleteTransfer(new_host_id, frontend_); |
| 179 found->second = host.release(); | 179 found->second = host.release(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace content | 182 } // namespace content |
| OLD | NEW |