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

Unified Diff: content/browser/service_worker/service_worker_internals_ui.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_internals_ui.cc
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc
index 2176eb75946b79d9357034e99dc6cec3c62cc055..c0d6ef75d11687f854c8b0fa9a492a3ad3152a73 100644
--- a/content/browser/service_worker/service_worker_internals_ui.cc
+++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -64,22 +64,18 @@ void OperationCompleteCallback(WeakPtr<ServiceWorkerInternalsUI> internals,
void CallServiceWorkerVersionMethodWithVersionID(
ServiceWorkerInternalsUI::ServiceWorkerVersionMethod method,
scoped_refptr<ServiceWorkerContextWrapper> context,
- int64 version_id,
+ std::string version_uuid,
const ServiceWorkerInternalsUI::StatusCallback& callback) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
- base::Bind(CallServiceWorkerVersionMethodWithVersionID,
- method,
- context,
- version_id,
- callback));
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(CallServiceWorkerVersionMethodWithVersionID, method, context,
+ version_uuid, callback));
return;
}
scoped_refptr<ServiceWorkerVersion> version =
- context->GetLiveVersion(version_id);
+ context->GetLiveVersion(version_uuid);
if (!version.get()) {
callback.Run(SERVICE_WORKER_ERROR_NOT_FOUND);
return;
@@ -89,21 +85,17 @@ void CallServiceWorkerVersionMethodWithVersionID(
void DispatchPushEventWithVersionID(
scoped_refptr<ServiceWorkerContextWrapper> context,
- int64 version_id,
+ std::string version_uuid,
const ServiceWorkerInternalsUI::StatusCallback& callback) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
- base::Bind(DispatchPushEventWithVersionID,
- context,
- version_id,
- callback));
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(DispatchPushEventWithVersionID, context,
+ version_uuid, callback));
return;
}
scoped_refptr<ServiceWorkerVersion> version =
- context->GetLiveVersion(version_id);
+ context->GetLiveVersion(version_uuid);
if (!version.get()) {
callback.Run(SERVICE_WORKER_ERROR_NOT_FOUND);
return;
@@ -150,7 +142,7 @@ void UpdateVersionInfo(const ServiceWorkerVersionInfo& version,
break;
}
info->SetString("script_url", version.script_url.spec());
- info->SetString("version_id", base::Int64ToString(version.version_id));
+ info->SetString("version_uuid", version.version_uuid);
info->SetInteger("process_id", version.process_id);
info->SetInteger("thread_id", version.thread_id);
info->SetInteger("devtools_agent_route_id", version.devtools_agent_route_id);
@@ -169,15 +161,13 @@ ListValue* GetRegistrationListValue(
registration_info->SetString(
"registration_id", base::Int64ToString(registration.registration_id));
- if (registration.active_version.version_id !=
- kInvalidServiceWorkerVersionId) {
+ if (!registration.active_version.version_uuid.empty()) {
DictionaryValue* active_info = new DictionaryValue();
UpdateVersionInfo(registration.active_version, active_info);
registration_info->Set("active", active_info);
}
- if (registration.waiting_version.version_id !=
- kInvalidServiceWorkerVersionId) {
+ if (!registration.waiting_version.version_uuid.empty()) {
DictionaryValue* waiting_info = new DictionaryValue();
UpdateVersionInfo(registration.waiting_version, waiting_info);
registration_info->Set("waiting", waiting_info);
@@ -251,29 +241,28 @@ class ServiceWorkerInternalsUI::PartitionObserver
: partition_id_(partition_id), web_ui_(web_ui) {}
~PartitionObserver() override {}
// ServiceWorkerContextObserver overrides:
- void OnRunningStateChanged(int64 version_id,
+ void OnRunningStateChanged(std::string version_uuid,
ServiceWorkerVersion::RunningStatus) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- web_ui_->CallJavascriptFunction(
- "serviceworker.onRunningStateChanged", FundamentalValue(partition_id_),
- StringValue(base::Int64ToString(version_id)));
+ web_ui_->CallJavascriptFunction("serviceworker.onRunningStateChanged",
+ FundamentalValue(partition_id_),
+ StringValue(version_uuid));
}
- void OnVersionStateChanged(int64 version_id,
+ void OnVersionStateChanged(std::string version_uuid,
ServiceWorkerVersion::Status) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- web_ui_->CallJavascriptFunction(
- "serviceworker.onVersionStateChanged",
- FundamentalValue(partition_id_),
- StringValue(base::Int64ToString(version_id)));
+ web_ui_->CallJavascriptFunction("serviceworker.onVersionStateChanged",
+ FundamentalValue(partition_id_),
+ StringValue(version_uuid));
}
- void OnErrorReported(int64 version_id,
+ void OnErrorReported(std::string version_uuid,
int process_id,
int thread_id,
const ErrorInfo& info) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
ScopedVector<const Value> args;
args.push_back(new FundamentalValue(partition_id_));
- args.push_back(new StringValue(base::Int64ToString(version_id)));
+ args.push_back(new StringValue(version_uuid));
args.push_back(new FundamentalValue(process_id));
args.push_back(new FundamentalValue(thread_id));
scoped_ptr<DictionaryValue> value(new DictionaryValue());
@@ -285,14 +274,14 @@ class ServiceWorkerInternalsUI::PartitionObserver
web_ui_->CallJavascriptFunction("serviceworker.onErrorReported",
args.get());
}
- void OnReportConsoleMessage(int64 version_id,
+ void OnReportConsoleMessage(std::string version_uuid,
int process_id,
int thread_id,
const ConsoleMessage& message) override {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
ScopedVector<const Value> args;
args.push_back(new FundamentalValue(partition_id_));
- args.push_back(new StringValue(base::Int64ToString(version_id)));
+ args.push_back(new StringValue(version_uuid));
args.push_back(new FundamentalValue(process_id));
args.push_back(new FundamentalValue(thread_id));
scoped_ptr<DictionaryValue> value(new DictionaryValue());
@@ -495,21 +484,19 @@ void ServiceWorkerInternalsUI::CallServiceWorkerVersionMethod(
const DictionaryValue* cmd_args = NULL;
int partition_id;
scoped_refptr<ServiceWorkerContextWrapper> context;
- std::string version_id_string;
- int64 version_id = 0;
+ std::string version_uuid;
if (!args->GetInteger(0, &callback_id) ||
!args->GetDictionary(1, &cmd_args) ||
!cmd_args->GetInteger("partition_id", &partition_id) ||
!GetServiceWorkerContext(partition_id, &context) ||
- !cmd_args->GetString("version_id", &version_id_string) ||
- !base::StringToInt64(version_id_string, &version_id)) {
+ !cmd_args->GetString("version_uuid", &version_uuid)) {
return;
}
base::Callback<void(ServiceWorkerStatusCode)> callback =
base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id);
- CallServiceWorkerVersionMethodWithVersionID(
- method, context, version_id, callback);
+ CallServiceWorkerVersionMethodWithVersionID(method, context, version_uuid,
+ callback);
}
void ServiceWorkerInternalsUI::DispatchPushEvent(
@@ -517,22 +504,20 @@ void ServiceWorkerInternalsUI::DispatchPushEvent(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
int callback_id;
int partition_id;
- int64 version_id = 0;
- std::string version_id_string;
+ std::string version_uuid = 0;
const DictionaryValue* cmd_args = NULL;
scoped_refptr<ServiceWorkerContextWrapper> context;
if (!args->GetInteger(0, &callback_id) ||
!args->GetDictionary(1, &cmd_args) ||
!cmd_args->GetInteger("partition_id", &partition_id) ||
!GetServiceWorkerContext(partition_id, &context) ||
- !cmd_args->GetString("version_id", &version_id_string) ||
- !base::StringToInt64(version_id_string, &version_id)) {
+ !cmd_args->GetString("version_uuid", &version_uuid)) {
return;
}
base::Callback<void(ServiceWorkerStatusCode)> callback =
base::Bind(OperationCompleteCallback, AsWeakPtr(), callback_id);
- DispatchPushEventWithVersionID(context, version_id, callback);
+ DispatchPushEventWithVersionID(context, version_uuid, callback);
}
void ServiceWorkerInternalsUI::InspectWorker(const ListValue* args) {
« no previous file with comments | « content/browser/service_worker/service_worker_info.cc ('k') | content/browser/service_worker/service_worker_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698