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

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

Issue 1845463002: Start implementing ForeignFetchEvent for foreign fetch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/ForeignFetchEvent.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ForeignFetchEvent.cpp b/third_party/WebKit/Source/modules/serviceworkers/ForeignFetchEvent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e2a1814ab2cdacf7b4028f244972def1b578bddb
--- /dev/null
+++ b/third_party/WebKit/Source/modules/serviceworkers/ForeignFetchEvent.cpp
@@ -0,0 +1,64 @@
+// Copyright 2016 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 "modules/serviceworkers/ForeignFetchEvent.h"
+
+#include "modules/fetch/Request.h"
+#include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+ForeignFetchEvent* ForeignFetchEvent::create()
+{
+ return new ForeignFetchEvent();
+}
+
+ForeignFetchEvent* ForeignFetchEvent::create(const AtomicString& type, const ForeignFetchEventInit& initializer)
+{
+ return new ForeignFetchEvent(type, initializer, nullptr);
+}
+
+ForeignFetchEvent* ForeignFetchEvent::create(const AtomicString& type, const ForeignFetchEventInit& initializer, ForeignFetchRespondWithObserver* observer)
+{
+ return new ForeignFetchEvent(type, initializer, observer);
+}
+
+Request* ForeignFetchEvent::request() const
+{
+ return m_request;
+}
+
+void ForeignFetchEvent::respondWith(ScriptState* scriptState, ScriptPromise scriptPromise, ExceptionState& exceptionState)
+{
+ stopImmediatePropagation();
+ if (m_observer)
+ m_observer->respondWith(scriptState, scriptPromise, exceptionState);
+}
+
+const AtomicString& ForeignFetchEvent::interfaceName() const
+{
+ return EventNames::ForeignFetchEvent;
+}
+
+ForeignFetchEvent::ForeignFetchEvent()
+{
+}
+
+ForeignFetchEvent::ForeignFetchEvent(const AtomicString& type, const ForeignFetchEventInit& initializer, ForeignFetchRespondWithObserver* observer)
+ : ExtendableEvent(type, initializer)
+ , m_observer(observer)
+{
+ if (initializer.hasRequest())
+ m_request = initializer.request();
+}
+
+DEFINE_TRACE(ForeignFetchEvent)
+{
+ visitor->trace(m_observer);
+ visitor->trace(m_request);
+ ExtendableEvent::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698