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

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

Issue 8949001: Fix some loose ends around recently introduced AppCache INTERCEPT namespaces (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
OLDNEW
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/appcache_host.h" 5 #include "webkit/appcache/appcache_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "webkit/appcache/appcache.h" 10 #include "webkit/appcache/appcache.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 AppCacheHost::AppCacheHost(int host_id, AppCacheFrontend* frontend, 44 AppCacheHost::AppCacheHost(int host_id, AppCacheFrontend* frontend,
45 AppCacheService* service) 45 AppCacheService* service)
46 : host_id_(host_id), 46 : host_id_(host_id),
47 spawning_host_id_(kNoHostId), spawning_process_id_(0), 47 spawning_host_id_(kNoHostId), spawning_process_id_(0),
48 parent_host_id_(kNoHostId), parent_process_id_(0), 48 parent_host_id_(kNoHostId), parent_process_id_(0),
49 pending_main_resource_cache_id_(kNoCacheId), 49 pending_main_resource_cache_id_(kNoCacheId),
50 pending_selected_cache_id_(kNoCacheId), 50 pending_selected_cache_id_(kNoCacheId),
51 frontend_(frontend), service_(service), 51 frontend_(frontend), service_(service),
52 pending_callback_param_(NULL), 52 pending_callback_param_(NULL),
53 main_resource_was_fallback_(false), main_resource_blocked_(false), 53 main_resource_was_namespace_entry_(false),
54 main_resource_blocked_(false),
54 associated_cache_info_pending_(false) { 55 associated_cache_info_pending_(false) {
55 } 56 }
56 57
57 AppCacheHost::~AppCacheHost() { 58 AppCacheHost::~AppCacheHost() {
58 FOR_EACH_OBSERVER(Observer, observers_, OnDestructionImminent(this)); 59 FOR_EACH_OBSERVER(Observer, observers_, OnDestructionImminent(this));
59 if (associated_cache_.get()) 60 if (associated_cache_.get())
60 associated_cache_->UnassociateHost(this); 61 associated_cache_->UnassociateHost(this);
61 if (group_being_updated_.get()) 62 if (group_being_updated_.get())
62 group_being_updated_->RemoveUpdateObserver(this); 63 group_being_updated_->RemoveUpdateObserver(this);
63 service_->storage()->CancelDelegateCallbacks(this); 64 service_->storage()->CancelDelegateCallbacks(this);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return; 154 return;
154 } 155 }
155 FinishCacheSelection(NULL, NULL); 156 FinishCacheSelection(NULL, NULL);
156 } 157 }
157 158
158 // TODO(michaeln): change method name to MarkEntryAsForeign for consistency 159 // TODO(michaeln): change method name to MarkEntryAsForeign for consistency
159 void AppCacheHost::MarkAsForeignEntry(const GURL& document_url, 160 void AppCacheHost::MarkAsForeignEntry(const GURL& document_url,
160 int64 cache_document_was_loaded_from) { 161 int64 cache_document_was_loaded_from) {
161 // The document url is not the resource url in the fallback case. 162 // The document url is not the resource url in the fallback case.
162 service_->storage()->MarkEntryAsForeign( 163 service_->storage()->MarkEntryAsForeign(
163 main_resource_was_fallback_ ? fallback_url_ : document_url, 164 main_resource_was_namespace_entry_ ? namespace_entry_url_ : document_url,
164 cache_document_was_loaded_from); 165 cache_document_was_loaded_from);
165 SelectCache(document_url, kNoCacheId, GURL()); 166 SelectCache(document_url, kNoCacheId, GURL());
166 } 167 }
167 168
168 void AppCacheHost::GetStatusWithCallback(const GetStatusCallback& callback, 169 void AppCacheHost::GetStatusWithCallback(const GetStatusCallback& callback,
169 void* callback_param) { 170 void* callback_param) {
170 DCHECK(pending_start_update_callback_.is_null() && 171 DCHECK(pending_start_update_callback_.is_null() &&
171 pending_swap_cache_callback_.is_null() && 172 pending_swap_cache_callback_.is_null() &&
172 pending_get_status_callback_.is_null()); 173 pending_get_status_callback_.is_null());
173 174
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 void AppCacheHost::LoadMainResourceCache(int64 cache_id) { 458 void AppCacheHost::LoadMainResourceCache(int64 cache_id) {
458 DCHECK(cache_id != kNoCacheId); 459 DCHECK(cache_id != kNoCacheId);
459 if (pending_main_resource_cache_id_ == cache_id || 460 if (pending_main_resource_cache_id_ == cache_id ||
460 (main_resource_cache_ && main_resource_cache_->cache_id() == cache_id)) { 461 (main_resource_cache_ && main_resource_cache_->cache_id() == cache_id)) {
461 return; 462 return;
462 } 463 }
463 pending_main_resource_cache_id_ = cache_id; 464 pending_main_resource_cache_id_ = cache_id;
464 service_->storage()->LoadCache(cache_id, this); 465 service_->storage()->LoadCache(cache_id, this);
465 } 466 }
466 467
467 void AppCacheHost::NotifyMainResourceFallback(const GURL& fallback_url) { 468 void AppCacheHost::NotifyMainResourceIsNamespaceEntry(
468 main_resource_was_fallback_ = true; 469 const GURL& namespace_entry_url) {
469 fallback_url_ = fallback_url; 470 main_resource_was_namespace_entry_ = true;
471 namespace_entry_url_ = namespace_entry_url;
470 } 472 }
471 473
472 void AppCacheHost::NotifyMainResourceBlocked(const GURL& manifest_url) { 474 void AppCacheHost::NotifyMainResourceBlocked(const GURL& manifest_url) {
473 main_resource_blocked_ = true; 475 main_resource_blocked_ = true;
474 blocked_manifest_url_ = manifest_url; 476 blocked_manifest_url_ = manifest_url;
475 } 477 }
476 478
477 void AppCacheHost::AssociateNoCache(const GURL& manifest_url) { 479 void AppCacheHost::AssociateNoCache(const GURL& manifest_url) {
478 // manifest url can be empty. 480 // manifest url can be empty.
479 AssociateCacheHelper(NULL, manifest_url); 481 AssociateCacheHelper(NULL, manifest_url);
(...skipping 22 matching lines...) Expand all
502 associated_cache_info_pending_ = cache && !cache->is_complete(); 504 associated_cache_info_pending_ = cache && !cache->is_complete();
503 AppCacheInfo info; 505 AppCacheInfo info;
504 if (cache) 506 if (cache)
505 cache->AssociateHost(this); 507 cache->AssociateHost(this);
506 508
507 FillCacheInfo(cache, manifest_url, GetStatus(), &info); 509 FillCacheInfo(cache, manifest_url, GetStatus(), &info);
508 frontend_->OnCacheSelected(host_id_, info); 510 frontend_->OnCacheSelected(host_id_, info);
509 } 511 }
510 512
511 } // namespace appcache 513 } // namespace appcache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698