Skip to content

Commit

Permalink
Remove the unused source_process_id and provider_host arguments to SW…
Browse files Browse the repository at this point in the history
… unregistration.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267087 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jyasskin@chromium.org committed Apr 30, 2014
1 parent 9a1526b commit 2fad096
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 34 deletions.
2 changes: 0 additions & 2 deletions content/browser/service_worker/service_worker_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerBlackBoxBrowserTest, Registration) {
base::RunLoop run_loop;
public_context()->UnregisterServiceWorker(
embedded_test_server()->GetURL("/*"),
RenderProcessID(),
base::Bind(&ServiceWorkerBlackBoxBrowserTest::ExpectResultAndRun,
true,
run_loop.QuitClosure()));
Expand Down Expand Up @@ -632,7 +631,6 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerBlackBoxBrowserTest, Registration) {
base::RunLoop run_loop;
public_context()->UnregisterServiceWorker(
embedded_test_server()->GetURL("/*"),
RenderProcessID(),
base::Bind(&ServiceWorkerBlackBoxBrowserTest::ExpectResultAndRun,
true,
run_loop.QuitClosure()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,10 @@ void ServiceWorkerContextCore::RegisterServiceWorker(

void ServiceWorkerContextCore::UnregisterServiceWorker(
const GURL& pattern,
int source_process_id,
ServiceWorkerProviderHost* provider_host,
const UnregistrationCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);

// TODO(kinuko): Wire the provider_host so that we can tell which document
// is calling .register.

job_coordinator_->Unregister(pattern, source_process_id, callback);
job_coordinator_->Unregister(pattern, callback);
}

void ServiceWorkerContextCore::RegistrationComplete(
Expand Down
2 changes: 0 additions & 2 deletions content/browser/service_worker/service_worker_context_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ class CONTENT_EXPORT ServiceWorkerContextCore

// The callback will be called on the IO thread.
void UnregisterServiceWorker(const GURL& pattern,
int source_process_id,
ServiceWorkerProviderHost* provider_host,
const UnregistrationCallback& callback);

// This class maintains collections of live instances, this class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ TEST_F(ServiceWorkerContextTest, Unregister) {
EXPECT_NE(kInvalidServiceWorkerVersionId, version_id);

called = false;
context()->UnregisterServiceWorker(
pattern, render_process_id_, NULL, MakeUnregisteredCallback(&called));
context()->UnregisterServiceWorker(pattern,
MakeUnregisteredCallback(&called));

ASSERT_FALSE(called);
base::RunLoop().RunUntilIdle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ static void FinishUnregistrationOnIO(

void ServiceWorkerContextWrapper::UnregisterServiceWorker(
const GURL& pattern,
int source_process_id,
const ResultCallback& continuation) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
Expand All @@ -118,15 +117,12 @@ void ServiceWorkerContextWrapper::UnregisterServiceWorker(
base::Bind(&ServiceWorkerContextWrapper::UnregisterServiceWorker,
this,
pattern,
source_process_id,
continuation));
return;
}

context()->UnregisterServiceWorker(
pattern,
source_process_id,
NULL /* provider_host */,
base::Bind(&FinishUnregistrationOnIO, continuation));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
const GURL& script_url,
const ResultCallback& continuation) OVERRIDE;
virtual void UnregisterServiceWorker(const GURL& pattern,
int source_process_id,
const ResultCallback& continuation)
OVERRIDE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(

context_->UnregisterServiceWorker(
pattern,
render_process_id_,
provider_host,
base::Bind(&ServiceWorkerDispatcherHost::UnregistrationComplete,
this,
thread_id,
Expand Down
2 changes: 0 additions & 2 deletions content/browser/service_worker/service_worker_internals_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ void ServiceWorkerInternalsUI::OperationProxy::UnregisterOnIOThread(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
context->context()->UnregisterServiceWorker(
scope,
0, // render process id?
NULL, // provider_host
base::Bind(&ServiceWorkerInternalsUI::OperationProxy::OperationComplete,
this));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void ServiceWorkerJobCoordinator::Register(

void ServiceWorkerJobCoordinator::Unregister(
const GURL& pattern,
int source_process_id,
const ServiceWorkerUnregisterJob::UnregistrationCallback& callback) {
scoped_ptr<ServiceWorkerRegisterJobBase> job(
new ServiceWorkerUnregisterJob(context_, pattern));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CONTENT_EXPORT ServiceWorkerJobCoordinator {

void Unregister(
const GURL& pattern,
int source_process_id,
const ServiceWorkerUnregisterJob::UnregistrationCallback& callback);

// Jobs are removed whenever they are finished or canceled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ TEST_F(ServiceWorkerJobTest, Unregister) {
ASSERT_TRUE(called);

job_coordinator()->Unregister(pattern,
render_process_id_,
SaveUnregistration(SERVICE_WORKER_OK, &called));

ASSERT_FALSE(called);
Expand All @@ -271,7 +270,6 @@ TEST_F(ServiceWorkerJobTest, Unregister_NothingRegistered) {

bool called;
job_coordinator()->Unregister(pattern,
render_process_id_,
SaveUnregistration(SERVICE_WORKER_OK, &called));

ASSERT_FALSE(called);
Expand Down Expand Up @@ -445,7 +443,6 @@ TEST_F(ServiceWorkerJobTest, ParallelRegUnreg) {
bool unregistration_called = false;
job_coordinator()->Unregister(
pattern,
render_process_id_,
SaveUnregistration(SERVICE_WORKER_OK, &unregistration_called));

ASSERT_FALSE(registration_called);
Expand Down Expand Up @@ -561,14 +558,11 @@ TEST_F(ServiceWorkerJobTest, ParallelUnreg) {
bool unregistration1_called = false;
job_coordinator()->Unregister(
pattern,
render_process_id_,
SaveUnregistration(SERVICE_WORKER_OK, &unregistration1_called));

bool unregistration2_called = false;
job_coordinator()->Unregister(
pattern,
render_process_id_,
SaveUnregistration(SERVICE_WORKER_OK, &unregistration2_called));
pattern, SaveUnregistration(SERVICE_WORKER_OK, &unregistration2_called));

ASSERT_FALSE(unregistration1_called);
ASSERT_FALSE(unregistration2_called);
Expand Down
7 changes: 3 additions & 4 deletions content/public/browser/service_worker_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ class ServiceWorkerContext {
const ResultCallback& callback) = 0;

// Equivalent to calling navigator.serviceWorker.unregister(pattern) from a
// renderer in |source_process_id|, except that |pattern| is an absolute URL
// instead of relative to some current origin. |callback| is passed true
// when the JS promise is fulfilled or false when the JS promise is rejected.
// renderer, except that |pattern| is an absolute URL instead of relative to
// some current origin. |callback| is passed true when the JS promise is
// fulfilled or false when the JS promise is rejected.
//
// Unregistration can fail if:
// * No Service Worker was registered for |pattern|.
// * Something unexpected goes wrong, like a renderer crash.
virtual void UnregisterServiceWorker(const Scope& pattern,
int source_process_id,
const ResultCallback& callback) = 0;

// TODO(jyasskin): Provide a way to SendMessage to a Scope.
Expand Down

0 comments on commit 2fad096

Please sign in to comment.