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

Unified Diff: Source/modules/navigatorconnect/WorkerNavigatorServices.cpp

Issue 1192913003: Start implementing new navigator.connect API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: override instead of virtual Created 5 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
Index: Source/modules/navigatorconnect/WorkerNavigatorServices.cpp
diff --git a/Source/modules/navigatorconnect/WorkerNavigatorServices.cpp b/Source/modules/navigatorconnect/WorkerNavigatorServices.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fce0bd21a714240ad612baf6be08997faee52931
--- /dev/null
+++ b/Source/modules/navigatorconnect/WorkerNavigatorServices.cpp
@@ -0,0 +1,54 @@
+// Copyright 2015 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.
+
+#include "config.h"
+#include "modules/navigatorconnect/WorkerNavigatorServices.h"
+
+#include "core/workers/WorkerNavigator.h"
+#include "modules/navigatorconnect/ServicePortCollection.h"
+
+namespace blink {
+
+WorkerNavigatorServices::~WorkerNavigatorServices()
+{
+}
+
+WorkerNavigatorServices& WorkerNavigatorServices::from(WorkerNavigator& navigator)
+{
+ WorkerNavigatorServices* supplement = static_cast<WorkerNavigatorServices*>(HeapSupplement<WorkerNavigator>::from(navigator, supplementName()));
+ if (!supplement) {
+ supplement = new WorkerNavigatorServices();
+ provideTo(navigator, supplementName(), supplement);
+ }
+ return *supplement;
+}
+
+ServicePortCollection* WorkerNavigatorServices::services(ExecutionContext* context, WorkerNavigator& navigator)
+{
+ return WorkerNavigatorServices::from(navigator).services(context);
+}
+
+ServicePortCollection* WorkerNavigatorServices::services(ExecutionContext* context)
+{
+ if (!m_services)
+ m_services = ServicePortCollection::create(context);
+ return m_services.get();
+}
+
+DEFINE_TRACE(WorkerNavigatorServices)
+{
+ visitor->trace(m_services);
+ HeapSupplement<WorkerNavigator>::trace(visitor);
+}
+
+WorkerNavigatorServices::WorkerNavigatorServices()
+{
+}
+
+const char* WorkerNavigatorServices::supplementName()
+{
+ return "WorkerNavigatorServices";
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698