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

Side by Side Diff: content/browser/service_worker/service_worker_register_job.cc

Issue 647953003: Service Worker script sizes in database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698