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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp

Issue 1439333002: Service Worker: Add Clients.get(id) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move the origin check lines and update layout tests Created 4 years, 10 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: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp
index 198f6e2afa25966372a7abc900bdd58a6a5852f6..6073a76456ce5f4dcaf3e5b02ce96516889f3740 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "modules/serviceworkers/ServiceWorkerClient.h"
+#include "modules/serviceworkers/ServiceWorkerWindowClient.h"
#include "bindings/core/v8/CallbackPromiseAdapter.h"
#include "bindings/core/v8/ExceptionState.h"
@@ -14,6 +15,23 @@
namespace blink {
+ServiceWorkerClient* ServiceWorkerClient::take(ScriptPromiseResolver*, PassOwnPtr<WebServiceWorkerClientInfo> webClient)
+{
+ if (!webClient)
+ return nullptr;
+
+ switch (webClient->clientType) {
+ case WebServiceWorkerClientTypeWindow:
+ return ServiceWorkerWindowClient::create(*webClient);
+ case WebServiceWorkerClientTypeWorker:
+ case WebServiceWorkerClientTypeSharedWorker:
+ return ServiceWorkerClient::create(*webClient);
+ case WebServiceWorkerClientTypeLast:
+ ASSERT_NOT_REACHED();
+ return nullptr;
+ }
+}
zino 2016/02/17 18:38:14 I think we should return null or something even if
nhiroki 2016/02/18 01:40:27 Agree. IIRC, MSVC may complain if there is not 'de
jungkees 2016/02/18 15:02:20 This actually causes a compile time error in some
+
ServiceWorkerClient* ServiceWorkerClient::create(const WebServiceWorkerClientInfo& info)
{
return new ServiceWorkerClient(info);

Powered by Google App Engine
This is Rietveld 408576698