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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 355163003: Don't prematurely delete script resources when registration is deleted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "content/browser/service_worker/embedded_worker_instance.h" 10 #include "content/browser/service_worker/embedded_worker_instance.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 stop_worker_timer_.Stop(); 380 stop_worker_timer_.Stop();
381 } 381 }
382 382
383 void ServiceWorkerVersion::RemoveControllee( 383 void ServiceWorkerVersion::RemoveControllee(
384 ServiceWorkerProviderHost* provider_host) { 384 ServiceWorkerProviderHost* provider_host) {
385 ControlleeMap::iterator found = controllee_map_.find(provider_host); 385 ControlleeMap::iterator found = controllee_map_.find(provider_host);
386 DCHECK(found != controllee_map_.end()); 386 DCHECK(found != controllee_map_.end());
387 controllee_by_id_.Remove(found->second); 387 controllee_by_id_.Remove(found->second);
388 controllee_map_.erase(found); 388 controllee_map_.erase(found);
389 RemoveProcessFromWorker(provider_host->process_id()); 389 RemoveProcessFromWorker(provider_host->process_id());
390 if (!HasControllee()) 390 if (!HasControllee()) {
391 ScheduleStopWorker(); 391 ScheduleStopWorker();
392 // TODO(kinuko): Fire NoControllees notification when the # of controllees 392 FOR_EACH_OBSERVER(Listener, listeners_, OnNoControllees(this));
393 // reaches 0, so that a new pending version can be activated (which will 393 }
394 // deactivate this version).
395 // TODO(michaeln): On no controllees call storage DeleteVersionResources
396 // if this version has been deactivated. Probably storage can listen for
397 // NoControllees for versions that have been deleted.
398 } 394 }
399 395
400 void ServiceWorkerVersion::AddWaitingControllee( 396 void ServiceWorkerVersion::AddWaitingControllee(
401 ServiceWorkerProviderHost* provider_host) { 397 ServiceWorkerProviderHost* provider_host) {
402 AddProcessToWorker(provider_host->process_id()); 398 AddProcessToWorker(provider_host->process_id());
403 } 399 }
404 400
405 void ServiceWorkerVersion::RemoveWaitingControllee( 401 void ServiceWorkerVersion::RemoveWaitingControllee(
406 ServiceWorkerProviderHost* provider_host) { 402 ServiceWorkerProviderHost* provider_host) {
407 RemoveProcessFromWorker(provider_host->process_id()); 403 RemoveProcessFromWorker(provider_host->process_id());
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 return; 652 return;
657 } 653 }
658 stop_worker_timer_.Start( 654 stop_worker_timer_.Start(
659 FROM_HERE, base::TimeDelta::FromSeconds(kStopWorkerDelay), 655 FROM_HERE, base::TimeDelta::FromSeconds(kStopWorkerDelay),
660 base::Bind(&ServiceWorkerVersion::StopWorker, 656 base::Bind(&ServiceWorkerVersion::StopWorker,
661 weak_factory_.GetWeakPtr(), 657 weak_factory_.GetWeakPtr(),
662 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback))); 658 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)));
663 } 659 }
664 660
665 } // namespace content 661 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698