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

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

Issue 2703343002: ServiceWorker: Use mojo's data pipe for respondWith(stream) (Closed)
Patch Set: Update comments 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 #ifndef WebServiceWorkerStreamHandle_h
6 #define WebServiceWorkerStreamHandle_h
7
8 #include <memory>
9
10 #include "mojo/public/cpp/system/data_pipe.h"
11 #include "public/platform/WebCommon.h"
12
13 namespace blink {
14
15 // Contains the info to send back a body to the page over Mojo's data pipe.
16 class BLINK_PLATFORM_EXPORT WebServiceWorkerStreamHandle {
17 public:
18 // Listener can observe whether the data pipe is successfully closed at the
19 // end of the body or it has accidentally finished.
20 class Listener {
21 public:
22 virtual ~Listener(){};
23 virtual void OnAborted() = 0;
24 virtual void OnCompleted() = 0;
25 };
26
27 void SetListener(std::unique_ptr<Listener>);
28 mojo::ScopedDataPipeConsumerHandle DrainStreamDataPipe();
29
30 #if INSIDE_BLINK
31 WebServiceWorkerStreamHandle(mojo::ScopedDataPipeConsumerHandle stream)
haraken 2017/04/19 11:29:10 Add explicit.
32 : stream_(std::move(stream)) {}
33 void Aborted();
34 void Completed();
35 #endif
36
37 private:
38 mojo::ScopedDataPipeConsumerHandle stream_;
39 std::unique_ptr<Listener> listener_;
40 };
41 }
42
43 #endif // WebServiceWorkerStreamHandle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698