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

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: 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 info.active_version.is_null = false;
583 if (it->is_active) 583 if (ServiceWorkerVersion* version =
584 info.active_version.status = ServiceWorkerVersion::ACTIVE; 584 context_->GetLiveVersion(it->version_id)) {
585 else 585 info.active_version = version->GetInfo();
nhiroki 2014/06/03 02:37:10 There might be a case that |version| hasn't been a
horo 2014/06/03 03:44:37 Done.
586 info.active_version.status = ServiceWorkerVersion::INSTALLED; 586 } else {
587 info.active_version.version_id = it->version_id; 587 if (it->is_active)
588 info.active_version.status = ServiceWorkerVersion::ACTIVE;
589 else
590 info.active_version.status = ServiceWorkerVersion::INSTALLED;
591 info.active_version.version_id = it->version_id;
592 }
588 infos.push_back(info); 593 infos.push_back(info);
589 } 594 }
590 595
591 // Add unstored registrations that are being installed. 596 // Add unstored registrations that are being installed.
592 for (RegistrationRefsById::const_iterator it = 597 for (RegistrationRefsById::const_iterator it =
593 installing_registrations_.begin(); 598 installing_registrations_.begin();
594 it != installing_registrations_.end(); ++it) { 599 it != installing_registrations_.end(); ++it) {
595 if (pushed_registrations.insert(it->first).second) 600 if (pushed_registrations.insert(it->first).second)
596 infos.push_back(it->second->GetInfo()); 601 infos.push_back(it->second->GetInfo());
597 } 602 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 const FindInDBCallback& callback) { 956 const FindInDBCallback& callback) {
952 ServiceWorkerDatabase::RegistrationData data; 957 ServiceWorkerDatabase::RegistrationData data;
953 ResourceList resources; 958 ResourceList resources;
954 ServiceWorkerDatabase::Status status = 959 ServiceWorkerDatabase::Status status =
955 database->ReadRegistration(registration_id, origin, &data, &resources); 960 database->ReadRegistration(registration_id, origin, &data, &resources);
956 original_task_runner->PostTask( 961 original_task_runner->PostTask(
957 FROM_HERE, base::Bind(callback, data, resources, status)); 962 FROM_HERE, base::Bind(callback, data, resources, status));
958 } 963 }
959 964
960 } // namespace content 965 } // 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