OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service_worker/service_worker_register_job.h" | 5 #include "content/browser/service_worker/service_worker_register_job.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 486 } |
487 | 487 |
488 void ServiceWorkerRegisterJob::OnPausedAfterDownload() { | 488 void ServiceWorkerRegisterJob::OnPausedAfterDownload() { |
489 // This happens prior to OnStartWorkerFinished time. | 489 // This happens prior to OnStartWorkerFinished time. |
490 scoped_refptr<ServiceWorkerVersion> most_recent_version = | 490 scoped_refptr<ServiceWorkerVersion> most_recent_version = |
491 registration()->waiting_version() ? | 491 registration()->waiting_version() ? |
492 registration()->waiting_version() : | 492 registration()->waiting_version() : |
493 registration()->active_version(); | 493 registration()->active_version(); |
494 DCHECK(most_recent_version.get()); | 494 DCHECK(most_recent_version.get()); |
495 int64 most_recent_script_id = | 495 int64 most_recent_script_id = |
496 most_recent_version->script_cache_map()->Lookup(script_url_); | 496 most_recent_version->script_cache_map()->LookupResourceId(script_url_); |
497 int64 new_script_id = | 497 int64 new_script_id = |
498 new_version()->script_cache_map()->Lookup(script_url_); | 498 new_version()->script_cache_map()->LookupResourceId(script_url_); |
499 | 499 |
500 // TODO(michaeln): It would be better to compare as the new resource | 500 // TODO(michaeln): It would be better to compare as the new resource |
501 // is being downloaded and to avoid writing it to disk until we know | 501 // is being downloaded and to avoid writing it to disk until we know |
502 // its needed. | 502 // its needed. |
503 context_->storage()->CompareScriptResources( | 503 context_->storage()->CompareScriptResources( |
504 most_recent_script_id, | 504 most_recent_script_id, |
505 new_script_id, | 505 new_script_id, |
506 base::Bind(&ServiceWorkerRegisterJob::OnCompareScriptResourcesComplete, | 506 base::Bind(&ServiceWorkerRegisterJob::OnCompareScriptResourcesComplete, |
507 weak_factory_.GetWeakPtr())); | 507 weak_factory_.GetWeakPtr())); |
508 } | 508 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 ServiceWorkerProviderHost* host = it->GetProviderHost(); | 551 ServiceWorkerProviderHost* host = it->GetProviderHost(); |
552 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 552 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
553 host->document_url())) { | 553 host->document_url())) { |
554 if (host->CanAssociateRegistration(registration)) | 554 if (host->CanAssociateRegistration(registration)) |
555 host->AssociateRegistration(registration); | 555 host->AssociateRegistration(registration); |
556 } | 556 } |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 } // namespace content | 560 } // namespace content |
OLD | NEW |