| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 489 } |
| 490 | 490 |
| 491 void ServiceWorkerRegisterJob::OnPausedAfterDownload() { | 491 void ServiceWorkerRegisterJob::OnPausedAfterDownload() { |
| 492 // This happens prior to OnStartWorkerFinished time. | 492 // This happens prior to OnStartWorkerFinished time. |
| 493 scoped_refptr<ServiceWorkerVersion> most_recent_version = | 493 scoped_refptr<ServiceWorkerVersion> most_recent_version = |
| 494 registration()->waiting_version() ? | 494 registration()->waiting_version() ? |
| 495 registration()->waiting_version() : | 495 registration()->waiting_version() : |
| 496 registration()->active_version(); | 496 registration()->active_version(); |
| 497 DCHECK(most_recent_version.get()); | 497 DCHECK(most_recent_version.get()); |
| 498 int64 most_recent_script_id = | 498 int64 most_recent_script_id = |
| 499 most_recent_version->script_cache_map()->Lookup(script_url_); | 499 most_recent_version->script_cache_map()->LookupResourceId(script_url_); |
| 500 int64 new_script_id = | 500 int64 new_script_id = |
| 501 new_version()->script_cache_map()->Lookup(script_url_); | 501 new_version()->script_cache_map()->LookupResourceId(script_url_); |
| 502 | 502 |
| 503 // TODO(michaeln): It would be better to compare as the new resource | 503 // TODO(michaeln): It would be better to compare as the new resource |
| 504 // is being downloaded and to avoid writing it to disk until we know | 504 // is being downloaded and to avoid writing it to disk until we know |
| 505 // its needed. | 505 // its needed. |
| 506 context_->storage()->CompareScriptResources( | 506 context_->storage()->CompareScriptResources( |
| 507 most_recent_script_id, | 507 most_recent_script_id, |
| 508 new_script_id, | 508 new_script_id, |
| 509 base::Bind(&ServiceWorkerRegisterJob::OnCompareScriptResourcesComplete, | 509 base::Bind(&ServiceWorkerRegisterJob::OnCompareScriptResourcesComplete, |
| 510 weak_factory_.GetWeakPtr())); | 510 weak_factory_.GetWeakPtr())); |
| 511 } | 511 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 ServiceWorkerProviderHost* host = it->GetProviderHost(); | 554 ServiceWorkerProviderHost* host = it->GetProviderHost(); |
| 555 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 555 if (ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
| 556 host->document_url())) { | 556 host->document_url())) { |
| 557 if (host->CanAssociateRegistration(registration)) | 557 if (host->CanAssociateRegistration(registration)) |
| 558 host->AssociateRegistration(registration); | 558 host->AssociateRegistration(registration); |
| 559 } | 559 } |
| 560 } | 560 } |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // namespace content | 563 } // namespace content |
| OLD | NEW |