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

Side by Side Diff: content/browser/service_worker/service_worker_registration.h

Issue 355163003: Don't prematurely delete script resources when registration is deleted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 27 matching lines...) Expand all
38 ServiceWorkerRegistration(const GURL& pattern, 38 ServiceWorkerRegistration(const GURL& pattern,
39 const GURL& script_url, 39 const GURL& script_url,
40 int64 registration_id, 40 int64 registration_id,
41 base::WeakPtr<ServiceWorkerContextCore> context); 41 base::WeakPtr<ServiceWorkerContextCore> context);
42 42
43 int64 id() const { return registration_id_; } 43 int64 id() const { return registration_id_; }
44 const GURL& script_url() const { return script_url_; } 44 const GURL& script_url() const { return script_url_; }
45 const GURL& pattern() const { return pattern_; } 45 const GURL& pattern() const { return pattern_; }
46 46
47 ServiceWorkerVersion* active_version() const { 47 ServiceWorkerVersion* active_version() const {
48 DCHECK(!is_shutdown_);
49 return active_version_.get(); 48 return active_version_.get();
50 } 49 }
51 50
52 ServiceWorkerVersion* waiting_version() const { 51 ServiceWorkerVersion* waiting_version() const {
53 DCHECK(!is_shutdown_);
54 return waiting_version_.get(); 52 return waiting_version_.get();
55 } 53 }
56 54
55 bool is_uninstalling() { return is_uninstalling_; }
56
57 void set_active_version(ServiceWorkerVersion* version) { 57 void set_active_version(ServiceWorkerVersion* version) {
58 DCHECK(!is_shutdown_);
59 active_version_ = version; 58 active_version_ = version;
60 } 59 }
61 60
62 void set_waiting_version(ServiceWorkerVersion* version) { 61 void set_waiting_version(ServiceWorkerVersion* version) {
63 DCHECK(!is_shutdown_);
64 waiting_version_ = version; 62 waiting_version_ = version;
65 } 63 }
66 64
65 void mark_as_uninstalling() { is_uninstalling_ = true; }
66
67 ServiceWorkerRegistrationInfo GetInfo(); 67 ServiceWorkerRegistrationInfo GetInfo();
68 68
69 // Returns the active version, if it is not null; otherwise, returns the 69 // Returns the active version, if it is not null; otherwise, returns the
70 // waiting version. 70 // waiting version.
71 ServiceWorkerVersion* GetNewestVersion(); 71 ServiceWorkerVersion* GetNewestVersion();
72 72
73 // The final synchronous switchover after all events have been 73 // The final synchronous switchover after all events have been
74 // fired, and the old "active version" is being shut down. 74 // fired, and the old "active version" is being shut down.
75 void ActivateWaitingVersion(); 75 void ActivateWaitingVersion();
76 76
77 private: 77 private:
78 ~ServiceWorkerRegistration(); 78 ~ServiceWorkerRegistration();
79 friend class base::RefCounted<ServiceWorkerRegistration>; 79 friend class base::RefCounted<ServiceWorkerRegistration>;
80 80
81 const GURL pattern_; 81 const GURL pattern_;
82 const GURL script_url_; 82 const GURL script_url_;
83 const int64 registration_id_; 83 const int64 registration_id_;
84 84
85 scoped_refptr<ServiceWorkerVersion> active_version_; 85 scoped_refptr<ServiceWorkerVersion> active_version_;
86 scoped_refptr<ServiceWorkerVersion> waiting_version_; 86 scoped_refptr<ServiceWorkerVersion> waiting_version_;
87 87
88 bool is_shutdown_; 88 bool is_uninstalling_;
89 base::WeakPtr<ServiceWorkerContextCore> context_; 89 base::WeakPtr<ServiceWorkerContextCore> context_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); 91 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
92 }; 92 };
93 } // namespace content 93 } // namespace content
94 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 94 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698