| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/navigatorconnect/WorkerNavigatorServices.h" |
| 7 |
| 8 #include "core/workers/WorkerNavigator.h" |
| 9 #include "modules/navigatorconnect/ServicePortCollection.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 WorkerNavigatorServices::~WorkerNavigatorServices() |
| 14 { |
| 15 } |
| 16 |
| 17 WorkerNavigatorServices& WorkerNavigatorServices::from(WorkerNavigator& navigato
r) |
| 18 { |
| 19 WorkerNavigatorServices* supplement = static_cast<WorkerNavigatorServices*>(
HeapSupplement<WorkerNavigator>::from(navigator, supplementName())); |
| 20 if (!supplement) { |
| 21 supplement = new WorkerNavigatorServices(); |
| 22 provideTo(navigator, supplementName(), supplement); |
| 23 } |
| 24 return *supplement; |
| 25 } |
| 26 |
| 27 ServicePortCollection* WorkerNavigatorServices::services(ExecutionContext* conte
xt, WorkerNavigator& navigator) |
| 28 { |
| 29 return WorkerNavigatorServices::from(navigator).services(context); |
| 30 } |
| 31 |
| 32 ServicePortCollection* WorkerNavigatorServices::services(ExecutionContext* conte
xt) |
| 33 { |
| 34 if (!m_services) |
| 35 m_services = ServicePortCollection::create(context); |
| 36 return m_services.get(); |
| 37 } |
| 38 |
| 39 DEFINE_TRACE(WorkerNavigatorServices) |
| 40 { |
| 41 visitor->trace(m_services); |
| 42 HeapSupplement<WorkerNavigator>::trace(visitor); |
| 43 } |
| 44 |
| 45 WorkerNavigatorServices::WorkerNavigatorServices() |
| 46 { |
| 47 } |
| 48 |
| 49 const char* WorkerNavigatorServices::supplementName() |
| 50 { |
| 51 return "WorkerNavigatorServices"; |
| 52 } |
| 53 |
| 54 } // namespace blink |
| OLD | NEW |