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

Side by Side Diff: extensions/browser/lazy_context_id.cc

Issue 2943583002: [extension SW] Support lazy events from extension service workers. (Closed)
Patch Set: sync @tott Created 3 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
« no previous file with comments | « extensions/browser/lazy_context_id.h ('k') | extensions/browser/lazy_context_task_queue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "extensions/browser/lazy_context_id.h" 5 #include "extensions/browser/lazy_context_id.h"
6 6
7 #include "extensions/browser/lazy_background_task_queue.h" 7 #include "extensions/browser/lazy_background_task_queue.h"
8 #include "extensions/browser/service_worker_task_queue.h"
8 9
9 namespace extensions { 10 namespace extensions {
10 11
11 LazyContextId::LazyContextId(content::BrowserContext* context, 12 LazyContextId::LazyContextId(content::BrowserContext* context,
12 const ExtensionId& extension_id) 13 const ExtensionId& extension_id)
13 : type_(Type::kEventPage), context_(context), extension_id_(extension_id) {} 14 : type_(Type::kEventPage), context_(context), extension_id_(extension_id) {}
14 15
15 LazyBackgroundTaskQueue* LazyContextId::GetTaskQueue() { 16 LazyContextId::LazyContextId(content::BrowserContext* context,
16 DCHECK(is_for_event_page()); 17 const ExtensionId& extension_id,
17 return LazyBackgroundTaskQueue::Get(context_); 18 const GURL& service_worker_scope)
19 : type_(Type::kServiceWorker),
20 context_(context),
21 extension_id_(extension_id),
22 service_worker_scope_(service_worker_scope) {}
23
24 LazyContextTaskQueue* LazyContextId::GetTaskQueue() {
25 if (is_for_event_page())
26 return LazyBackgroundTaskQueue::Get(context_);
27 DCHECK(is_for_service_worker());
28 return ServiceWorkerTaskQueue::Get(context_);
18 } 29 }
19 30
20 } // namespace extensions 31 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/lazy_context_id.h ('k') | extensions/browser/lazy_context_task_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698