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

Unified Diff: third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerStreamHandle.h

Issue 2703343002: ServiceWorker: Use mojo's data pipe for respondWith(stream) (Closed)
Patch Set: Used TEST_P to test closing the connection first and On{Aborted,Completed} first Created 3 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/public/platform/modules/serviceworker/WebServiceWorkerStreamHandle.h
diff --git a/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerStreamHandle.h b/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerStreamHandle.h
new file mode 100644
index 0000000000000000000000000000000000000000..e84879d8ee1652c6bc244c5a9a32da416f48c512
--- /dev/null
+++ b/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerStreamHandle.h
@@ -0,0 +1,39 @@
+// Copyright 2017 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.
+
+#ifndef WebServiceWorkerStreamHandle_h
+#define WebServiceWorkerStreamHandle_h
+
+#include <memory>
+
+#include "mojo/public/cpp/system/data_pipe.h"
+#include "public/platform/WebCommon.h"
+
+namespace blink {
+
+class BLINK_PLATFORM_EXPORT WebServiceWorkerStreamHandle {
+ public:
+ class Listener {
+ public:
+ virtual void OnAborted() = 0;
+ virtual void OnCompleted() = 0;
+ };
+
+ void setListener(std::unique_ptr<Listener>);
+ mojo::ScopedDataPipeConsumerHandle drainStreamDataPipe();
+
+#if INSIDE_BLINK
+ WebServiceWorkerStreamHandle(mojo::ScopedDataPipeConsumerHandle stream)
+ : m_stream(std::move(stream)) {}
+ void aborted();
+ void completed();
+#endif
+
+ private:
+ mojo::ScopedDataPipeConsumerHandle m_stream;
+ std::unique_ptr<Listener> m_listener;
+};
+}
+
+#endif // WebServiceWorkerStreamHandle_h

Powered by Google App Engine
This is Rietveld 408576698