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

Unified Diff: content/browser/service_worker/service_worker_context_core.cc

Issue 1221643014: Service Worker: Migrate to version_uuid and surface ServiceWorker.id. (Chromium 2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_context_core.cc
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc
index a45441c4a8b5d85a5c31964c5d74211716ac8961..7b3c35436ed051fcd78ef3c3905c23b8b2e499a3 100644
--- a/content/browser/service_worker/service_worker_context_core.cc
+++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -391,26 +391,25 @@ void ServiceWorkerContextCore::RemoveLiveRegistration(int64 id) {
live_registrations_.erase(id);
}
-ServiceWorkerVersion* ServiceWorkerContextCore::GetLiveVersion(
- int64 id) {
+ServiceWorkerVersion* ServiceWorkerContextCore::GetLiveVersion(std::string id) {
VersionMap::iterator it = live_versions_.find(id);
return (it != live_versions_.end()) ? it->second : NULL;
}
void ServiceWorkerContextCore::AddLiveVersion(ServiceWorkerVersion* version) {
- DCHECK(!GetLiveVersion(version->version_id()));
- live_versions_[version->version_id()] = version;
+ DCHECK(!GetLiveVersion(version->version_uuid()));
+ live_versions_[version->version_uuid()] = version;
version->AddListener(this);
if (observer_list_.get()) {
observer_list_->Notify(FROM_HERE,
&ServiceWorkerContextObserver::OnNewLiveVersion,
- version->version_id(), version->registration_id(),
+ version->version_uuid(), version->registration_id(),
version->script_url());
}
}
-void ServiceWorkerContextCore::RemoveLiveVersion(int64 id) {
- live_versions_.erase(id);
+void ServiceWorkerContextCore::RemoveLiveVersion(std::string version_uuid) {
+ live_versions_.erase(version_uuid);
}
std::vector<ServiceWorkerRegistrationInfo>
@@ -428,10 +427,9 @@ ServiceWorkerContextCore::GetAllLiveRegistrationInfo() {
std::vector<ServiceWorkerVersionInfo>
ServiceWorkerContextCore::GetAllLiveVersionInfo() {
std::vector<ServiceWorkerVersionInfo> infos;
- for (std::map<int64, ServiceWorkerVersion*>::const_iterator iter =
+ for (std::map<std::string, ServiceWorkerVersion*>::const_iterator iter =
live_versions_.begin();
- iter != live_versions_.end();
- ++iter) {
+ iter != live_versions_.end(); ++iter) {
infos.push_back(iter->second->GetInfo());
}
return infos;
@@ -439,14 +437,14 @@ ServiceWorkerContextCore::GetAllLiveVersionInfo() {
void ServiceWorkerContextCore::ProtectVersion(
const scoped_refptr<ServiceWorkerVersion>& version) {
- DCHECK(protected_versions_.find(version->version_id()) ==
+ DCHECK(protected_versions_.find(version->version_uuid()) ==
protected_versions_.end());
- protected_versions_[version->version_id()] = version;
+ protected_versions_[version->version_uuid()] = version;
}
-void ServiceWorkerContextCore::UnprotectVersion(int64 version_id) {
- DCHECK(protected_versions_.find(version_id) != protected_versions_.end());
- protected_versions_.erase(version_id);
+void ServiceWorkerContextCore::UnprotectVersion(std::string version_uuid) {
+ DCHECK(protected_versions_.find(version_uuid) != protected_versions_.end());
+ protected_versions_.erase(version_uuid);
}
int ServiceWorkerContextCore::GetNewServiceWorkerHandleId() {
@@ -508,7 +506,7 @@ void ServiceWorkerContextCore::OnRunningStateChanged(
return;
observer_list_->Notify(FROM_HERE,
&ServiceWorkerContextObserver::OnRunningStateChanged,
- version->version_id(), version->running_status());
+ version->version_uuid(), version->running_status());
}
void ServiceWorkerContextCore::OnVersionStateChanged(
@@ -517,7 +515,7 @@ void ServiceWorkerContextCore::OnVersionStateChanged(
return;
observer_list_->Notify(FROM_HERE,
&ServiceWorkerContextObserver::OnVersionStateChanged,
- version->version_id(), version->status());
+ version->version_uuid(), version->status());
}
void ServiceWorkerContextCore::OnMainScriptHttpResponseInfoSet(
@@ -531,7 +529,7 @@ void ServiceWorkerContextCore::OnMainScriptHttpResponseInfoSet(
info->headers->GetLastModifiedValue(&lastModified);
observer_list_->Notify(
FROM_HERE, &ServiceWorkerContextObserver::OnMainScriptHttpResponseInfoSet,
- version->version_id(), info->response_time, lastModified);
+ version->version_uuid(), info->response_time, lastModified);
}
void ServiceWorkerContextCore::OnErrorReported(
@@ -544,7 +542,7 @@ void ServiceWorkerContextCore::OnErrorReported(
return;
observer_list_->Notify(
FROM_HERE, &ServiceWorkerContextObserver::OnErrorReported,
- version->version_id(), version->embedded_worker()->process_id(),
+ version->version_uuid(), version->embedded_worker()->process_id(),
version->embedded_worker()->thread_id(),
ServiceWorkerContextObserver::ErrorInfo(error_message, line_number,
column_number, source_url));
@@ -561,7 +559,7 @@ void ServiceWorkerContextCore::OnReportConsoleMessage(
return;
observer_list_->Notify(
FROM_HERE, &ServiceWorkerContextObserver::OnReportConsoleMessage,
- version->version_id(), version->embedded_worker()->process_id(),
+ version->version_uuid(), version->embedded_worker()->process_id(),
version->embedded_worker()->thread_id(),
ServiceWorkerContextObserver::ConsoleMessage(
source_identifier, message_level, message, line_number, source_url));
@@ -574,7 +572,7 @@ void ServiceWorkerContextCore::OnControlleeAdded(
return;
observer_list_->Notify(FROM_HERE,
&ServiceWorkerContextObserver::OnControlleeAdded,
- version->version_id(), provider_host->client_uuid(),
+ version->version_uuid(), provider_host->client_uuid(),
provider_host->process_id(), provider_host->route_id(),
provider_host->provider_type());
}
@@ -586,7 +584,7 @@ void ServiceWorkerContextCore::OnControlleeRemoved(
return;
observer_list_->Notify(FROM_HERE,
&ServiceWorkerContextObserver::OnControlleeRemoved,
- version->version_id(), provider_host->client_uuid());
+ version->version_uuid(), provider_host->client_uuid());
}
ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() {

Powered by Google App Engine
This is Rietveld 408576698