OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/appcache/appcache.h" | 5 #include "webkit/browser/appcache/appcache.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 AppCacheExecutableHandler* AppCache::GetExecutableHandler(int64 response_id) { | 88 AppCacheExecutableHandler* AppCache::GetExecutableHandler(int64 response_id) { |
89 HandlerMap::const_iterator found = executable_handlers_.find(response_id); | 89 HandlerMap::const_iterator found = executable_handlers_.find(response_id); |
90 if (found != executable_handlers_.end()) | 90 if (found != executable_handlers_.end()) |
91 return found->second; | 91 return found->second; |
92 return NULL; | 92 return NULL; |
93 } | 93 } |
94 | 94 |
95 AppCacheExecutableHandler* AppCache::GetOrCreateExecutableHandler( | 95 AppCacheExecutableHandler* AppCache::GetOrCreateExecutableHandler( |
96 int64 response_id, net::IOBuffer* handler_source) { | 96 int64 response_id, const std::string& raw_handler_source) { |
97 AppCacheExecutableHandler* handler = GetExecutableHandler(response_id); | 97 AppCacheExecutableHandler* handler = GetExecutableHandler(response_id); |
98 if (handler) | 98 if (handler) |
99 return handler; | 99 return handler; |
100 | 100 |
101 GURL handler_url; | 101 GURL handler_url; |
102 const AppCacheEntry* entry = GetEntryAndUrlWithResponseId( | 102 const AppCacheEntry* entry = GetEntryAndUrlWithResponseId( |
103 response_id, &handler_url); | 103 response_id, &handler_url); |
104 if (!entry || !entry->IsExecutable()) | 104 if (!entry || !entry->IsExecutable()) |
105 return NULL; | 105 return NULL; |
106 | 106 |
107 DCHECK(storage_->service()->handler_factory()); | 107 DCHECK(storage_->service()->executable_handler_factory()); |
108 scoped_ptr<AppCacheExecutableHandler> own_ptr = | 108 scoped_ptr<AppCacheExecutableHandler> own_ptr = |
109 storage_->service()->handler_factory()-> | 109 storage_->service()->executable_handler_factory()-> |
110 CreateHandler(handler_url, handler_source); | 110 CreateHandler(cache_id_, handler_url, raw_handler_source); |
111 handler = own_ptr.release(); | 111 handler = own_ptr.release(); |
112 if (!handler) | 112 if (!handler) |
113 return NULL; | 113 return NULL; |
114 executable_handlers_[response_id] = handler; | 114 executable_handlers_[response_id] = handler; |
115 return handler; | 115 return handler; |
116 } | 116 } |
117 | 117 |
118 GURL AppCache::GetNamespaceEntryUrl(const NamespaceVector& namespaces, | 118 GURL AppCache::GetNamespaceEntryUrl(const NamespaceVector& namespaces, |
119 const GURL& namespace_url) const { | 119 const GURL& namespace_url) const { |
120 size_t count = namespaces.size(); | 120 size_t count = namespaces.size(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 iter != entries_.end(); ++iter) { | 297 iter != entries_.end(); ++iter) { |
298 infos->push_back(AppCacheResourceInfo()); | 298 infos->push_back(AppCacheResourceInfo()); |
299 AppCacheResourceInfo& info = infos->back(); | 299 AppCacheResourceInfo& info = infos->back(); |
300 info.url = iter->first; | 300 info.url = iter->first; |
301 info.is_master = iter->second.IsMaster(); | 301 info.is_master = iter->second.IsMaster(); |
302 info.is_manifest = iter->second.IsManifest(); | 302 info.is_manifest = iter->second.IsManifest(); |
303 info.is_intercept = iter->second.IsIntercept(); | 303 info.is_intercept = iter->second.IsIntercept(); |
304 info.is_fallback = iter->second.IsFallback(); | 304 info.is_fallback = iter->second.IsFallback(); |
305 info.is_foreign = iter->second.IsForeign(); | 305 info.is_foreign = iter->second.IsForeign(); |
306 info.is_explicit = iter->second.IsExplicit(); | 306 info.is_explicit = iter->second.IsExplicit(); |
| 307 info.is_executable = iter->second.IsExecutable(); |
307 info.size = iter->second.response_size(); | 308 info.size = iter->second.response_size(); |
308 info.response_id = iter->second.response_id(); | 309 info.response_id = iter->second.response_id(); |
309 } | 310 } |
310 } | 311 } |
311 | 312 |
312 // static | 313 // static |
313 const Namespace* AppCache::FindNamespace( | 314 const Namespace* AppCache::FindNamespace( |
314 const NamespaceVector& namespaces, | 315 const NamespaceVector& namespaces, |
315 const GURL& url) { | 316 const GURL& url) { |
316 size_t count = namespaces.size(); | 317 size_t count = namespaces.size(); |
317 for (size_t i = 0; i < count; ++i) { | 318 for (size_t i = 0; i < count; ++i) { |
318 if (namespaces[i].IsMatch(url)) | 319 if (namespaces[i].IsMatch(url)) |
319 return &namespaces[i]; | 320 return &namespaces[i]; |
320 } | 321 } |
321 return NULL; | 322 return NULL; |
322 } | 323 } |
323 | 324 |
324 } // namespace appcache | 325 } // namespace appcache |
OLD | NEW |