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

Unified Diff: mojo/edk/js/drain_data.cc

Issue 1722543003: Mojo bindings environment: remove usage in mojo/edk/js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « mojo/edk/js/drain_data.h ('k') | mojo/edk/js/test/run_js_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/js/drain_data.cc
diff --git a/mojo/edk/js/drain_data.cc b/mojo/edk/js/drain_data.cc
index bc5d22300f61201acf6bb560f9e0c6faca869bbe..3b0a195e5524535427cdbed470bcd9b931debf30 100644
--- a/mojo/edk/js/drain_data.cc
+++ b/mojo/edk/js/drain_data.cc
@@ -7,12 +7,12 @@
#include <stddef.h>
#include <stdint.h>
+#include "base/bind.h"
#include "gin/array_buffer.h"
#include "gin/converter.h"
#include "gin/dictionary.h"
#include "gin/per_context_data.h"
#include "gin/per_isolate_data.h"
-#include "mojo/public/cpp/environment/environment.h"
#include "mojo/public/cpp/system/core.h"
namespace mojo {
@@ -20,10 +20,7 @@ namespace edk {
namespace js {
DrainData::DrainData(v8::Isolate* isolate, mojo::Handle handle)
- : isolate_(isolate),
- handle_(DataPipeConsumerHandle(handle.value())),
- wait_id_(0) {
-
+ : isolate_(isolate), handle_(DataPipeConsumerHandle(handle.value())) {
v8::Handle<v8::Context> context(isolate_->GetCurrentContext());
runner_ = gin::PerContextData::From(context)->runner()->GetWeakPtr();
@@ -39,22 +36,16 @@ v8::Handle<v8::Value> DrainData::GetPromise() {
}
DrainData::~DrainData() {
- if (wait_id_)
- Environment::GetDefaultAsyncWaiter()->CancelWait(wait_id_);
resolver_.Reset();
}
void DrainData::WaitForData() {
- wait_id_ = Environment::GetDefaultAsyncWaiter()->AsyncWait(
- handle_.get().value(),
- MOJO_HANDLE_SIGNAL_READABLE,
- MOJO_DEADLINE_INDEFINITE,
- &DrainData::WaitCompleted,
- this);
+ handle_watcher_.Start(
+ handle_.get(), MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE,
+ base::Bind(&DrainData::DataReady, base::Unretained(this)));
}
void DrainData::DataReady(MojoResult result) {
- wait_id_ = 0;
if (result != MOJO_RESULT_OK) {
DeliverData(result);
return;
« no previous file with comments | « mojo/edk/js/drain_data.h ('k') | mojo/edk/js/test/run_js_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698