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

Unified Diff: content/common/service_worker/service_worker_types.h

Issue 360123002: ServiceWorker: some more groundwork in support of the update process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/service_worker/service_worker_types.h
diff --git a/content/common/service_worker/service_worker_types.h b/content/common/service_worker/service_worker_types.h
index 8ee5545d50c2c464b6d5891d2b9effaf2cbc4e4d..86324baf8d320fe65ee1b4c820942d1f1bcce1f5 100644
--- a/content/common/service_worker/service_worker_types.h
+++ b/content/common/service_worker/service_worker_types.h
@@ -31,6 +31,15 @@ const static int64 kInvalidServiceWorkerVersionId = -1;
const static int64 kInvalidServiceWorkerResourceId = -1;
const static int64 kInvalidServiceWorkerResponseId = -1;
+// Indicates how the service worker handled a fetch event.
+enum ServiceWorkerFetchEventResult {
+ // Browser should fallback to native fetch.
+ SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK,
+ // Service worker provided a ServiceWorkerResponse.
+ SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE,
+ SERVICE_WORKER_FETCH_EVENT_LAST = SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE
+};
+
// To dispatch fetch request from browser to child process.
// TODO(kinuko): This struct will definitely need more fields and
// we'll probably want to have response struct/class too.
@@ -48,15 +57,6 @@ struct CONTENT_EXPORT ServiceWorkerFetchRequest {
bool is_reload;
};
-// Indicates how the service worker handled a fetch event.
-enum ServiceWorkerFetchEventResult {
- // Browser should fallback to native fetch.
- SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK,
- // Service worker provided a ServiceWorkerResponse.
- SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE,
- SERVICE_WORKER_FETCH_EVENT_LAST = SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE
-};
-
// Represents a response to a fetch.
struct CONTENT_EXPORT ServiceWorkerResponse {
ServiceWorkerResponse();
@@ -81,6 +81,30 @@ struct CONTENT_EXPORT ServiceWorkerObjectInfo {
blink::WebServiceWorkerState state;
};
+class ChangedVersionAttributesMask {
+ public:
+ enum {
+ INSTALLING_VERSION = 1 << 0,
+ WAITING_VERSION = 1 << 1,
+ ACTIVE_VERSION = 1 << 2,
+ CONTROLLING_VERSION = 1 << 3,
+ };
+
+ ChangedVersionAttributesMask() : changed_(0) {}
+ explicit ChangedVersionAttributesMask(int changed) : changed_(changed) {}
+
+ int changed() const { return changed_; }
+
+ void add(int changed_versions) { changed_ |= changed_versions; }
+ bool installing_changed() const { return !!(changed_ & INSTALLING_VERSION); }
+ bool waiting_changed() const { return !!(changed_ & WAITING_VERSION); }
+ bool active_changed() const { return !!(changed_ & ACTIVE_VERSION); }
+ bool controller_changed() const { return !!(changed_ & CONTROLLING_VERSION); }
+
+ private:
+ int changed_;
+};
+
} // namespace content
#endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698