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

Unified Diff: content/browser/service_worker/service_worker_context_watcher.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_watcher.cc
diff --git a/content/browser/service_worker/service_worker_context_watcher.cc b/content/browser/service_worker/service_worker_context_watcher.cc
index 51d5e126c6c94e15df37cda350a441310d085eda..d0f64353f67e25e9bafa77d08118255f6dca1527 100644
--- a/content/browser/service_worker/service_worker_context_watcher.cc
+++ b/content/browser/service_worker/service_worker_context_watcher.cc
@@ -121,9 +121,9 @@ void ServiceWorkerContextWatcher::StoreRegistrationInfo(
void ServiceWorkerContextWatcher::StoreVersionInfo(
const ServiceWorkerVersionInfo& version_info) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (version_info.version_id == kInvalidServiceWorkerVersionId)
+ if (!version_info.version_uuid.empty())
return;
- version_info_map_.set(version_info.version_id,
+ version_info_map_.set(version_info.version_uuid,
scoped_ptr<ServiceWorkerVersionInfo>(
new ServiceWorkerVersionInfo(version_info)));
}
@@ -154,106 +154,106 @@ void ServiceWorkerContextWatcher::OnNewLiveRegistration(int64 registration_id,
ServiceWorkerRegistrationInfo::IS_NOT_DELETED);
}
-void ServiceWorkerContextWatcher::OnNewLiveVersion(int64 version_id,
+void ServiceWorkerContextWatcher::OnNewLiveVersion(std::string version_uuid,
int64 registration_id,
const GURL& script_url) {
- if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id)) {
+ if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid)) {
DCHECK_EQ(version->registration_id, registration_id);
DCHECK_EQ(version->script_url, script_url);
return;
}
scoped_ptr<ServiceWorkerVersionInfo> version(new ServiceWorkerVersionInfo());
- version->version_id = version_id;
+ version->version_uuid = version_uuid;
version->registration_id = registration_id;
version->script_url = script_url;
SendVersionInfo(*version);
if (!IsStoppedAndRedundant(*version))
- version_info_map_.set(version_id, version.Pass());
+ version_info_map_.set(version_uuid, version.Pass());
}
void ServiceWorkerContextWatcher::OnRunningStateChanged(
- int64 version_id,
+ std::string version_uuid,
content::ServiceWorkerVersion::RunningStatus running_status) {
- ServiceWorkerVersionInfo* version = version_info_map_.get(version_id);
+ ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid);
DCHECK(version);
if (version->running_status == running_status)
return;
version->running_status = running_status;
SendVersionInfo(*version);
if (IsStoppedAndRedundant(*version))
- version_info_map_.erase(version_id);
+ version_info_map_.erase(version_uuid);
}
void ServiceWorkerContextWatcher::OnVersionStateChanged(
- int64 version_id,
+ std::string version_uuid,
content::ServiceWorkerVersion::Status status) {
- ServiceWorkerVersionInfo* version = version_info_map_.get(version_id);
+ ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid);
DCHECK(version);
if (version->status == status)
return;
version->status = status;
SendVersionInfo(*version);
if (IsStoppedAndRedundant(*version))
- version_info_map_.erase(version_id);
+ version_info_map_.erase(version_uuid);
}
void ServiceWorkerContextWatcher::OnMainScriptHttpResponseInfoSet(
- int64 version_id,
+ std::string version_uuid,
base::Time script_response_time,
base::Time script_last_modified) {
- ServiceWorkerVersionInfo* version = version_info_map_.get(version_id);
+ ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid);
DCHECK(version);
version->script_response_time = script_response_time;
version->script_last_modified = script_last_modified;
SendVersionInfo(*version);
}
-void ServiceWorkerContextWatcher::OnErrorReported(int64 version_id,
+void ServiceWorkerContextWatcher::OnErrorReported(std::string version_uuid,
int process_id,
int thread_id,
const ErrorInfo& info) {
int64 registration_id = kInvalidServiceWorkerRegistrationId;
- if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id))
+ if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid))
registration_id = version->registration_id;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(error_callback_, registration_id, version_id, info));
+ base::Bind(error_callback_, registration_id, version_uuid, info));
}
void ServiceWorkerContextWatcher::OnReportConsoleMessage(
- int64 version_id,
+ std::string version_uuid,
int process_id,
int thread_id,
const ConsoleMessage& message) {
if (message.message_level != CONSOLE_MESSAGE_LEVEL_ERROR)
return;
int64 registration_id = kInvalidServiceWorkerRegistrationId;
- if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id))
+ if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid))
registration_id = version->registration_id;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(error_callback_, registration_id, version_id,
+ base::Bind(error_callback_, registration_id, version_uuid,
ErrorInfo(message.message, message.line_number, -1,
message.source_url)));
}
void ServiceWorkerContextWatcher::OnControlleeAdded(
- int64 version_id,
+ std::string version_uuid,
const std::string& uuid,
int process_id,
int route_id,
ServiceWorkerProviderType type) {
- ServiceWorkerVersionInfo* version = version_info_map_.get(version_id);
+ ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid);
DCHECK(version);
version->clients[uuid] =
ServiceWorkerVersionInfo::ClientInfo(process_id, route_id, type);
SendVersionInfo(*version);
}
-void ServiceWorkerContextWatcher::OnControlleeRemoved(int64 version_id,
+void ServiceWorkerContextWatcher::OnControlleeRemoved(std::string version_uuid,
const std::string& uuid) {
- ServiceWorkerVersionInfo* version = version_info_map_.get(version_id);
+ ServiceWorkerVersionInfo* version = version_info_map_.get(version_uuid);
DCHECK(version);
version->clients.erase(uuid);
SendVersionInfo(*version);

Powered by Google App Engine
This is Rietveld 408576698