Commit 29be3dc6 authored by kinuko's avatar kinuko Committed by Commit bot

ServiceWorkerVersion: remove unused parameter in DispatchInstallEvent

I believe the param (active_version_id) was a remnant of the ancient spec/impl.

BUG=n/a

Review URL: https://codereview.chromium.org/966393002

Cr-Commit-Position: refs/heads/master@{#319031}
parent a54ae4ff
...@@ -137,8 +137,7 @@ void EmbeddedWorkerTestHelper::OnActivateEvent(int embedded_worker_id, ...@@ -137,8 +137,7 @@ void EmbeddedWorkerTestHelper::OnActivateEvent(int embedded_worker_id,
} }
void EmbeddedWorkerTestHelper::OnInstallEvent(int embedded_worker_id, void EmbeddedWorkerTestHelper::OnInstallEvent(int embedded_worker_id,
int request_id, int request_id) {
int active_version_id) {
// The installing worker may have been doomed and terminated. // The installing worker may have been doomed and terminated.
if (!registry()->GetWorker(embedded_worker_id)) if (!registry()->GetWorker(embedded_worker_id))
return; return;
...@@ -283,15 +282,13 @@ void EmbeddedWorkerTestHelper::OnActivateEventStub(int request_id) { ...@@ -283,15 +282,13 @@ void EmbeddedWorkerTestHelper::OnActivateEventStub(int request_id) {
request_id)); request_id));
} }
void EmbeddedWorkerTestHelper::OnInstallEventStub(int request_id, void EmbeddedWorkerTestHelper::OnInstallEventStub(int request_id) {
int active_version_id) {
base::MessageLoopProxy::current()->PostTask( base::MessageLoopProxy::current()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&EmbeddedWorkerTestHelper::OnInstallEvent, base::Bind(&EmbeddedWorkerTestHelper::OnInstallEvent,
weak_factory_.GetWeakPtr(), weak_factory_.GetWeakPtr(),
current_embedded_worker_id_, current_embedded_worker_id_,
request_id, request_id));
active_version_id));
} }
void EmbeddedWorkerTestHelper::OnFetchEventStub( void EmbeddedWorkerTestHelper::OnFetchEventStub(
......
...@@ -92,9 +92,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, ...@@ -92,9 +92,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
// worker. By default they just return success via // worker. By default they just return success via
// SimulateSendReplyToBrowser. // SimulateSendReplyToBrowser.
virtual void OnActivateEvent(int embedded_worker_id, int request_id); virtual void OnActivateEvent(int embedded_worker_id, int request_id);
virtual void OnInstallEvent(int embedded_worker_id, virtual void OnInstallEvent(int embedded_worker_id, int request_id);
int request_id,
int active_version_id);
virtual void OnFetchEvent(int embedded_worker_id, virtual void OnFetchEvent(int embedded_worker_id,
int request_id, int request_id,
const ServiceWorkerFetchRequest& request); const ServiceWorkerFetchRequest& request);
...@@ -119,7 +117,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, ...@@ -119,7 +117,7 @@ class EmbeddedWorkerTestHelper : public IPC::Sender,
int embedded_worker_id, int embedded_worker_id,
const IPC::Message& message); const IPC::Message& message);
void OnActivateEventStub(int request_id); void OnActivateEventStub(int request_id);
void OnInstallEventStub(int request_id, int active_version_id); void OnInstallEventStub(int request_id);
void OnFetchEventStub(int request_id, void OnFetchEventStub(int request_id,
const ServiceWorkerFetchRequest& request); const ServiceWorkerFetchRequest& request);
......
...@@ -568,7 +568,7 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { ...@@ -568,7 +568,7 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest {
ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
version_->SetStatus(ServiceWorkerVersion::INSTALLING); version_->SetStatus(ServiceWorkerVersion::INSTALLING);
version_->DispatchInstallEvent( version_->DispatchInstallEvent(
-1, CreateReceiver(BrowserThread::UI, done, result)); CreateReceiver(BrowserThread::UI, done, result));
} }
void ActivateOnIOThread(const base::Closure& done, void ActivateOnIOThread(const base::Closure& done,
......
...@@ -81,8 +81,7 @@ class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { ...@@ -81,8 +81,7 @@ class RejectInstallTestHelper : public EmbeddedWorkerTestHelper {
: EmbeddedWorkerTestHelper(mock_render_process_id) {} : EmbeddedWorkerTestHelper(mock_render_process_id) {}
void OnInstallEvent(int embedded_worker_id, void OnInstallEvent(int embedded_worker_id,
int request_id, int request_id) override {
int active_version_id) override {
SimulateSend( SimulateSend(
new ServiceWorkerHostMsg_InstallEventFinished( new ServiceWorkerHostMsg_InstallEventFinished(
embedded_worker_id, request_id, embedded_worker_id, request_id,
......
...@@ -134,7 +134,7 @@ TEST_F(ServiceWorkerHandleTest, OnVersionStateChanged) { ...@@ -134,7 +134,7 @@ TEST_F(ServiceWorkerHandleTest, OnVersionStateChanged) {
// ...dispatch install event. // ...dispatch install event.
status = SERVICE_WORKER_ERROR_FAILED; status = SERVICE_WORKER_ERROR_FAILED;
version_->SetStatus(ServiceWorkerVersion::INSTALLING); version_->SetStatus(ServiceWorkerVersion::INSTALLING);
version_->DispatchInstallEvent(-1, CreateReceiverOnCurrentThread(&status)); version_->DispatchInstallEvent(CreateReceiverOnCurrentThread(&status));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_EQ(SERVICE_WORKER_OK, status);
......
...@@ -1262,8 +1262,7 @@ class EventCallbackHelper : public EmbeddedWorkerTestHelper { ...@@ -1262,8 +1262,7 @@ class EventCallbackHelper : public EmbeddedWorkerTestHelper {
activate_event_result_(blink::WebServiceWorkerEventResultCompleted) {} activate_event_result_(blink::WebServiceWorkerEventResultCompleted) {}
void OnInstallEvent(int embedded_worker_id, void OnInstallEvent(int embedded_worker_id,
int request_id, int request_id) override {
int active_version_id) override {
if (!install_callback_.is_null()) if (!install_callback_.is_null())
install_callback_.Run(); install_callback_.Run();
SimulateSend( SimulateSend(
......
...@@ -377,7 +377,6 @@ void ServiceWorkerRegisterJob::InstallAndContinue() { ...@@ -377,7 +377,6 @@ void ServiceWorkerRegisterJob::InstallAndContinue() {
// "Fire an event named install..." // "Fire an event named install..."
new_version()->DispatchInstallEvent( new_version()->DispatchInstallEvent(
-1,
base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished, base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
......
...@@ -463,7 +463,6 @@ void ServiceWorkerVersion::DispatchMessageEventInternal( ...@@ -463,7 +463,6 @@ void ServiceWorkerVersion::DispatchMessageEventInternal(
} }
void ServiceWorkerVersion::DispatchInstallEvent( void ServiceWorkerVersion::DispatchInstallEvent(
int active_version_id,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_EQ(INSTALLING, status()) << status(); DCHECK_EQ(INSTALLING, status()) << status();
...@@ -475,10 +474,9 @@ void ServiceWorkerVersion::DispatchInstallEvent( ...@@ -475,10 +474,9 @@ void ServiceWorkerVersion::DispatchInstallEvent(
callback, callback,
base::Bind(&self::DispatchInstallEventAfterStartWorker, base::Bind(&self::DispatchInstallEventAfterStartWorker,
weak_factory_.GetWeakPtr(), weak_factory_.GetWeakPtr(),
active_version_id,
callback))); callback)));
} else { } else {
DispatchInstallEventAfterStartWorker(active_version_id, callback); DispatchInstallEventAfterStartWorker(callback);
} }
} }
...@@ -944,14 +942,13 @@ void ServiceWorkerVersion::OnStartMessageSent( ...@@ -944,14 +942,13 @@ void ServiceWorkerVersion::OnStartMessageSent(
} }
void ServiceWorkerVersion::DispatchInstallEventAfterStartWorker( void ServiceWorkerVersion::DispatchInstallEventAfterStartWorker(
int active_version_id,
const StatusCallback& callback) { const StatusCallback& callback) {
DCHECK_EQ(RUNNING, running_status()) DCHECK_EQ(RUNNING, running_status())
<< "Worker stopped too soon after it was started."; << "Worker stopped too soon after it was started.";
int request_id = install_callbacks_.Add(new StatusCallback(callback)); int request_id = install_callbacks_.Add(new StatusCallback(callback));
ServiceWorkerStatusCode status = embedded_worker_->SendMessage( ServiceWorkerStatusCode status = embedded_worker_->SendMessage(
ServiceWorkerMsg_InstallEvent(request_id, active_version_id)); ServiceWorkerMsg_InstallEvent(request_id));
if (status != SERVICE_WORKER_OK) { if (status != SERVICE_WORKER_OK) {
install_callbacks_.Remove(request_id); install_callbacks_.Remove(request_id);
RunSoon(base::Bind(callback, status)); RunSoon(base::Bind(callback, status));
......
...@@ -175,15 +175,12 @@ class CONTENT_EXPORT ServiceWorkerVersion ...@@ -175,15 +175,12 @@ class CONTENT_EXPORT ServiceWorkerVersion
// Sends install event to the associated embedded worker and asynchronously // Sends install event to the associated embedded worker and asynchronously
// calls |callback| when it errors out or it gets a response from the worker // calls |callback| when it errors out or it gets a response from the worker
// to notify install completion. // to notify install completion.
// |active_version_id| must be a valid positive ID
// if there's an activated (previous) version running.
// //
// This must be called when the status() is NEW. Calling this changes // This must be called when the status() is NEW. Calling this changes
// the version's status to INSTALLING. // the version's status to INSTALLING.
// Upon completion, the version's status will be changed to INSTALLED // Upon completion, the version's status will be changed to INSTALLED
// on success, or back to NEW on failure. // on success, or back to NEW on failure.
void DispatchInstallEvent(int active_version_id, void DispatchInstallEvent(const StatusCallback& callback);
const StatusCallback& callback);
// Sends activate event to the associated embedded worker and asynchronously // Sends activate event to the associated embedded worker and asynchronously
// calls |callback| when it errors out or it gets a response from the worker // calls |callback| when it errors out or it gets a response from the worker
...@@ -341,8 +338,7 @@ class CONTENT_EXPORT ServiceWorkerVersion ...@@ -341,8 +338,7 @@ class CONTENT_EXPORT ServiceWorkerVersion
void OnStartMessageSent(ServiceWorkerStatusCode status); void OnStartMessageSent(ServiceWorkerStatusCode status);
void DispatchInstallEventAfterStartWorker(int active_version_id, void DispatchInstallEventAfterStartWorker(const StatusCallback& callback);
const StatusCallback& callback);
void DispatchActivateEventAfterStartWorker(const StatusCallback& callback); void DispatchActivateEventAfterStartWorker(const StatusCallback& callback);
void DispatchMessageEventInternal( void DispatchMessageEventInternal(
......
...@@ -256,7 +256,7 @@ TEST_F(ServiceWorkerVersionTest, DispatchEventToStoppedWorker) { ...@@ -256,7 +256,7 @@ TEST_F(ServiceWorkerVersionTest, DispatchEventToStoppedWorker) {
// Dispatch an event without starting the worker. // Dispatch an event without starting the worker.
ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
version_->SetStatus(ServiceWorkerVersion::INSTALLING); version_->SetStatus(ServiceWorkerVersion::INSTALLING);
version_->DispatchInstallEvent(-1, CreateReceiverOnCurrentThread(&status)); version_->DispatchInstallEvent(CreateReceiverOnCurrentThread(&status));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_EQ(SERVICE_WORKER_OK, status);
...@@ -267,8 +267,7 @@ TEST_F(ServiceWorkerVersionTest, DispatchEventToStoppedWorker) { ...@@ -267,8 +267,7 @@ TEST_F(ServiceWorkerVersionTest, DispatchEventToStoppedWorker) {
status = SERVICE_WORKER_ERROR_FAILED; status = SERVICE_WORKER_ERROR_FAILED;
ServiceWorkerStatusCode stop_status = SERVICE_WORKER_ERROR_FAILED; ServiceWorkerStatusCode stop_status = SERVICE_WORKER_ERROR_FAILED;
version_->StopWorker(CreateReceiverOnCurrentThread(&stop_status)); version_->StopWorker(CreateReceiverOnCurrentThread(&stop_status));
version_->DispatchInstallEvent( version_->DispatchInstallEvent(CreateReceiverOnCurrentThread(&status));
-1, CreateReceiverOnCurrentThread(&status));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(SERVICE_WORKER_OK, stop_status); EXPECT_EQ(SERVICE_WORKER_OK, stop_status);
...@@ -308,7 +307,7 @@ TEST_F(ServiceWorkerVersionTest, InstallAndWaitCompletion) { ...@@ -308,7 +307,7 @@ TEST_F(ServiceWorkerVersionTest, InstallAndWaitCompletion) {
// Dispatch an install event. // Dispatch an install event.
ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
version_->DispatchInstallEvent(-1, CreateReceiverOnCurrentThread(&status)); version_->DispatchInstallEvent(CreateReceiverOnCurrentThread(&status));
// Wait for the completion. // Wait for the completion.
bool status_change_called = false; bool status_change_called = false;
......
...@@ -425,9 +425,8 @@ IPC_MESSAGE_CONTROL5( ...@@ -425,9 +425,8 @@ IPC_MESSAGE_CONTROL5(
std::vector<int> /* new_routing_ids */) std::vector<int> /* new_routing_ids */)
// Sent via EmbeddedWorker to dispatch events. // Sent via EmbeddedWorker to dispatch events.
IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_InstallEvent, IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_InstallEvent,
int /* request_id */, int /* request_id */)
int /* active_version_id */)
IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_ActivateEvent, IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_ActivateEvent,
int /* request_id */) int /* request_id */)
IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FetchEvent, IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FetchEvent,
......
...@@ -314,8 +314,7 @@ void ServiceWorkerScriptContext::OnActivateEvent(int request_id) { ...@@ -314,8 +314,7 @@ void ServiceWorkerScriptContext::OnActivateEvent(int request_id) {
proxy_->dispatchActivateEvent(request_id); proxy_->dispatchActivateEvent(request_id);
} }
void ServiceWorkerScriptContext::OnInstallEvent(int request_id, void ServiceWorkerScriptContext::OnInstallEvent(int request_id) {
int active_version_id) {
TRACE_EVENT0("ServiceWorker", TRACE_EVENT0("ServiceWorker",
"ServiceWorkerScriptContext::OnInstallEvent"); "ServiceWorkerScriptContext::OnInstallEvent");
install_start_timings_[request_id] = base::TimeTicks::Now(); install_start_timings_[request_id] = base::TimeTicks::Now();
......
...@@ -113,7 +113,7 @@ class ServiceWorkerScriptContext { ...@@ -113,7 +113,7 @@ class ServiceWorkerScriptContext {
SkipWaitingCallbacksMap; SkipWaitingCallbacksMap;
void OnActivateEvent(int request_id); void OnActivateEvent(int request_id);
void OnInstallEvent(int request_id, int active_version_id); void OnInstallEvent(int request_id);
void OnFetchEvent(int request_id, const ServiceWorkerFetchRequest& request); void OnFetchEvent(int request_id, const ServiceWorkerFetchRequest& request);
void OnSyncEvent(int request_id); void OnSyncEvent(int request_id);
void OnNotificationClickEvent( void OnNotificationClickEvent(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment