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

Side by Side Diff: mojo/bindings/js/drain_data.h

Issue 577733002: Mojo JS bindings: draining a DataPipe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revised the way the TaskObserver is managed Created 6 years, 3 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 2014 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 MOJO_BINDINGS_JS_DRAIN_DATA_H_
6 #define MOJO_BINDINGS_JS_DRAIN_DATA_H_
7
8 #include "gin/runner.h"
9 #include "mojo/public/c/environment/async_waiter.h"
10 #include "mojo/public/cpp/system/core.h"
11 #include "v8/include/v8.h"
12
13
14 namespace mojo {
15 namespace js {
16
17 class DrainData {
Matt Perry 2014/09/24 00:39:42 Please add some comments to this class and methods
hansmuller 2014/09/24 17:47:53 Done.
18 public:
19 DrainData(v8::Isolate* isolate, mojo::Handle handle);
20 v8::Handle<v8::Value> GetPromise();
21
22 private:
23 ~DrainData();
24
25 void WaitForData();
26 static void WaitCompleted(void* thisDrainData, MojoResult result) {
Matt Perry 2014/09/24 00:39:42 this_drain_data (or maybe self?)
hansmuller 2014/09/24 17:47:53 Done.
27 static_cast<DrainData*>(thisDrainData)->DataReady(result);
28 }
29 void DataReady(MojoResult result);
30 MojoResult ReadData();
31 void DeliverData(MojoResult result);
32
33 typedef std::vector<char> DataBuffer;
34
35 v8::Isolate* isolate_;
36 ScopedDataPipeConsumerHandle handle_;
37 MojoAsyncWaitID wait_id_;
38 base::WeakPtr<gin::Runner> runner_;
39 v8::UniquePersistent<v8::Promise::Resolver> resolver_;
40 std::vector<DataBuffer> data_buffers_;
41 };
42
43 } // namespace js
44 } // namespace mojo
45
46 #endif // MOJO_BINDINGS_JS_DRAIN_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698