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

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

Issue 307223003: Fills the info about the live versions which aren't in the live registrations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: omit bracket Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_storage.h" 5 #include "content/browser/service_worker/service_worker_storage.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 ServiceWorkerRegistration* registration = 572 ServiceWorkerRegistration* registration =
573 context_->GetLiveRegistration(it->registration_id); 573 context_->GetLiveRegistration(it->registration_id);
574 if (registration) { 574 if (registration) {
575 infos.push_back(registration->GetInfo()); 575 infos.push_back(registration->GetInfo());
576 continue; 576 continue;
577 } 577 }
578 ServiceWorkerRegistrationInfo info; 578 ServiceWorkerRegistrationInfo info;
579 info.pattern = it->scope; 579 info.pattern = it->scope;
580 info.script_url = it->script; 580 info.script_url = it->script;
581 info.registration_id = it->registration_id; 581 info.registration_id = it->registration_id;
582 info.active_version.is_null = false; 582 if (ServiceWorkerVersion* version =
583 if (it->is_active) 583 context_->GetLiveVersion(it->version_id)) {
584 info.active_version.status = ServiceWorkerVersion::ACTIVE; 584 if (it->is_active)
585 else 585 info.active_version = version->GetInfo();
586 info.active_version.status = ServiceWorkerVersion::INSTALLED; 586 else
587 info.active_version.version_id = it->version_id; 587 info.pending_version = version->GetInfo();
588 } else {
589 info.active_version.is_null = false;
590 if (it->is_active)
591 info.active_version.status = ServiceWorkerVersion::ACTIVE;
592 else
593 info.active_version.status = ServiceWorkerVersion::INSTALLED;
594 info.active_version.version_id = it->version_id;
595 }
588 infos.push_back(info); 596 infos.push_back(info);
589 } 597 }
590 598
591 // Add unstored registrations that are being installed. 599 // Add unstored registrations that are being installed.
592 for (RegistrationRefsById::const_iterator it = 600 for (RegistrationRefsById::const_iterator it =
593 installing_registrations_.begin(); 601 installing_registrations_.begin();
594 it != installing_registrations_.end(); ++it) { 602 it != installing_registrations_.end(); ++it) {
595 if (pushed_registrations.insert(it->first).second) 603 if (pushed_registrations.insert(it->first).second)
596 infos.push_back(it->second->GetInfo()); 604 infos.push_back(it->second->GetInfo());
597 } 605 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 const FindInDBCallback& callback) { 959 const FindInDBCallback& callback) {
952 ServiceWorkerDatabase::RegistrationData data; 960 ServiceWorkerDatabase::RegistrationData data;
953 ResourceList resources; 961 ResourceList resources;
954 ServiceWorkerDatabase::Status status = 962 ServiceWorkerDatabase::Status status =
955 database->ReadRegistration(registration_id, origin, &data, &resources); 963 database->ReadRegistration(registration_id, origin, &data, &resources);
956 original_task_runner->PostTask( 964 original_task_runner->PostTask(
957 FROM_HERE, base::Bind(callback, data, resources, status)); 965 FROM_HERE, base::Bind(callback, data, resources, status));
958 } 966 }
959 967
960 } // namespace content 968 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698