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

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

Issue 380093002: Update installed ServiceWorkers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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_VERSION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 STOPPING = EmbeddedWorkerInstance::STOPPING, 57 STOPPING = EmbeddedWorkerInstance::STOPPING,
58 }; 58 };
59 59
60 // Current version status; some of the status (e.g. INSTALLED and ACTIVATED) 60 // Current version status; some of the status (e.g. INSTALLED and ACTIVATED)
61 // should be persisted unlike running status. 61 // should be persisted unlike running status.
62 enum Status { 62 enum Status {
63 NEW, // The version is just created. 63 NEW, // The version is just created.
64 INSTALLING, // Install event is dispatched and being handled. 64 INSTALLING, // Install event is dispatched and being handled.
65 INSTALLED, // Install event is finished and is ready to be activated. 65 INSTALLED, // Install event is finished and is ready to be activated.
66 ACTIVATING, // Activate event is dispatched and being handled. 66 ACTIVATING, // Activate event is dispatched and being handled.
67 ACTIVATED, // Activation is finished and can run as activated. 67 ACTIVATED, // Activation is finished and can run as activated.
68 REDUNDANT, // The version is no longer running as activated, due to 68 REDUNDANT, // The version is no longer running as activated, due to
69 // unregistration or replace. 69 // unregistration or replace.
70 }; 70 };
71 71
72 class Listener { 72 class Listener {
73 public: 73 public:
74 virtual void OnWorkerStarted(ServiceWorkerVersion* version) {} 74 virtual void OnWorkerStarted(ServiceWorkerVersion* version) {}
75 virtual void OnWorkerStopped(ServiceWorkerVersion* version) {} 75 virtual void OnWorkerStopped(ServiceWorkerVersion* version) {}
76 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) {} 76 virtual void OnVersionStateChanged(ServiceWorkerVersion* version) {}
77 virtual void OnErrorReported(ServiceWorkerVersion* version, 77 virtual void OnErrorReported(ServiceWorkerVersion* version,
78 const base::string16& error_message, 78 const base::string16& error_message,
79 int line_number, 79 int line_number,
80 int column_number, 80 int column_number,
81 const GURL& source_url) {} 81 const GURL& source_url) {}
82 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, 82 virtual void OnReportConsoleMessage(ServiceWorkerVersion* version,
83 int source_identifier, 83 int source_identifier,
84 int message_level, 84 int message_level,
85 const base::string16& message, 85 const base::string16& message,
86 int line_number, 86 int line_number,
87 const GURL& source_url) {} 87 const GURL& source_url) {}
88 // Fires when a version transitions from having a controllee to not.
89 virtual void OnNoControllees(ServiceWorkerVersion* version) {}
90
91 protected:
92 virtual ~Listener() {}
88 }; 93 };
89 94
90 ServiceWorkerVersion( 95 ServiceWorkerVersion(
91 ServiceWorkerRegistration* registration, 96 ServiceWorkerRegistration* registration,
92 int64 version_id, 97 int64 version_id,
93 base::WeakPtr<ServiceWorkerContextCore> context); 98 base::WeakPtr<ServiceWorkerContextCore> context);
94 99
95 int64 version_id() const { return version_id_; } 100 int64 version_id() const { return version_id_; }
96 int64 registration_id() const { return registration_id_; } 101 int64 registration_id() const { return registration_id_; }
97 const GURL& script_url() const { return script_url_; } 102 const GURL& script_url() const { return script_url_; }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 bool is_doomed_; 301 bool is_doomed_;
297 302
298 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; 303 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
299 304
300 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); 305 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
301 }; 306 };
302 307
303 } // namespace content 308 } // namespace content
304 309
305 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 310 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698