| OLD | NEW |
| 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 |
| OLD | NEW |