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

Unified Diff: extensions/browser/service_worker_task_queue.h

Issue 2943583002: [extension SW] Support lazy events from extension service workers. (Closed)
Patch Set: sync @tott Created 3 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 | « extensions/browser/lazy_context_task_queue.h ('k') | extensions/browser/service_worker_task_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/service_worker_task_queue.h
diff --git a/extensions/browser/service_worker_task_queue.h b/extensions/browser/service_worker_task_queue.h
new file mode 100644
index 0000000000000000000000000000000000000000..07ffe18134a6f33b49cdc5d99e51745562a7a1e4
--- /dev/null
+++ b/extensions/browser/service_worker_task_queue.h
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_SERVICE_WORKER_TASK_QUEUE_H_
+#define EXTENSIONS_BROWSER_SERVICE_WORKER_TASK_QUEUE_H_
+
+#include "components/keyed_service/core/keyed_service.h"
+#include "extensions/browser/lazy_context_task_queue.h"
+#include "extensions/common/extension_id.h"
+#include "url/gurl.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace extensions {
+class Extension;
+class LazyContextId;
+
+// TODO(lazyboy): This class doesn't queue up any tasks, implement. See
+// LazyBackgroundTaskQueue.
+// TODO(lazyboy): Clean up queue when extension is unloaded/uninstalled.
+class ServiceWorkerTaskQueue : public KeyedService,
+ public LazyContextTaskQueue {
+ public:
+ explicit ServiceWorkerTaskQueue(content::BrowserContext* browser_context);
+ ~ServiceWorkerTaskQueue() override;
+
+ // Convenience method to return the ServiceWorkerTaskQueue for a given
+ // |context|.
+ static ServiceWorkerTaskQueue* Get(content::BrowserContext* context);
+
+ bool ShouldEnqueueTask(content::BrowserContext* context,
+ const Extension* extension) override;
+ void AddPendingTaskToDispatchEvent(
+ LazyContextId* context_id,
+ const LazyContextTaskQueue::PendingTask& task) override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerTaskQueue);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_SERVICE_WORKER_TASK_QUEUE_H_
« no previous file with comments | « extensions/browser/lazy_context_task_queue.h ('k') | extensions/browser/service_worker_task_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698