| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_EDK_JS_DRAIN_DATA_H_ | 5 #ifndef MOJO_EDK_JS_DRAIN_DATA_H_ |
| 6 #define MOJO_EDK_JS_DRAIN_DATA_H_ | 6 #define MOJO_EDK_JS_DRAIN_DATA_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "gin/runner.h" | 9 #include "gin/runner.h" |
| 10 #include "mojo/public/c/environment/async_waiter.h" | 10 #include "mojo/public/c/environment/async_waiter.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // Use ReadData() to read whatever is availble now on handle_ and save | 42 // Use ReadData() to read whatever is availble now on handle_ and save |
| 43 // it in data_buffers_. | 43 // it in data_buffers_. |
| 44 void DataReady(MojoResult result); | 44 void DataReady(MojoResult result); |
| 45 MojoResult ReadData(); | 45 MojoResult ReadData(); |
| 46 | 46 |
| 47 // When the remote data pipe handle is closed, or an error occurs, deliver | 47 // When the remote data pipe handle is closed, or an error occurs, deliver |
| 48 // all of the buffered data to the JS Promise and then delete this. | 48 // all of the buffered data to the JS Promise and then delete this. |
| 49 void DeliverData(MojoResult result); | 49 void DeliverData(MojoResult result); |
| 50 | 50 |
| 51 typedef std::vector<char> DataBuffer; | 51 using DataBuffer = std::vector<char>; |
| 52 | 52 |
| 53 v8::Isolate* isolate_; | 53 v8::Isolate* isolate_; |
| 54 ScopedDataPipeConsumerHandle handle_; | 54 ScopedDataPipeConsumerHandle handle_; |
| 55 MojoAsyncWaitID wait_id_; | 55 MojoAsyncWaitID wait_id_; |
| 56 base::WeakPtr<gin::Runner> runner_; | 56 base::WeakPtr<gin::Runner> runner_; |
| 57 v8::UniquePersistent<v8::Promise::Resolver> resolver_; | 57 v8::UniquePersistent<v8::Promise::Resolver> resolver_; |
| 58 ScopedVector<DataBuffer> data_buffers_; | 58 ScopedVector<DataBuffer> data_buffers_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace js | 61 } // namespace js |
| 62 } // namespace mojo | 62 } // namespace mojo |
| 63 | 63 |
| 64 #endif // MOJO_EDK_JS_DRAIN_DATA_H_ | 64 #endif // MOJO_EDK_JS_DRAIN_DATA_H_ |
| OLD | NEW |