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

Unified Diff: sky/engine/platform/fetcher/DrainDataPipeJob.h

Issue 650903006: Factor DrainDataPipeJob out of MojoLoader (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 | « sky/engine/platform/DEPS ('k') | sky/engine/platform/fetcher/DrainDataPipeJob.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/platform/fetcher/DrainDataPipeJob.h
diff --git a/sky/engine/platform/fetcher/DrainDataPipeJob.h b/sky/engine/platform/fetcher/DrainDataPipeJob.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b35f32915c2e5eb10802b8fe39b5c49b7ad54e6
--- /dev/null
+++ b/sky/engine/platform/fetcher/DrainDataPipeJob.h
@@ -0,0 +1,44 @@
+// Copyright 2014 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 SKY_ENGINE_PLATFORM_FETCHER_DRAIN_DATA_PIPE_JOB_H_
+#define SKY_ENGINE_PLATFORM_FETCHER_DRAIN_DATA_PIPE_JOB_H_
+
+#include "base/memory/weak_ptr.h"
+#include "mojo/common/handle_watcher.h"
+#include "mojo/public/cpp/system/core.h"
+
+namespace blink {
+
+class DrainDataPipeJob {
eseidel 2014/10/24 19:00:42 DataPipeDrainer? I have trouble with this name.
+ public:
+ class Client {
+ public:
+ virtual void OnDataAvailable(const void* data, size_t num_bytes) = 0;
+ virtual void OnDataComplete() = 0;
+
+ protected:
+ virtual ~Client() { }
+ };
+
+ DrainDataPipeJob(Client*, mojo::ScopedDataPipeConsumerHandle source);
+ ~DrainDataPipeJob();
+
+ private:
+ void ReadData();
+ void WaitForData();
+ void WaitComplete(MojoResult result);
+
+ Client* client_;
+ mojo::ScopedDataPipeConsumerHandle source_;
+ mojo::common::HandleWatcher handle_watcher_;
+
+ base::WeakPtrFactory<DrainDataPipeJob> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DrainDataPipeJob);
+};
+
+} // namespace blink
+
+#endif // SKY_ENGINE_PLATFORM_FETCHER_DRAIN_DATA_PIPE_JOB_H_
« no previous file with comments | « sky/engine/platform/DEPS ('k') | sky/engine/platform/fetcher/DrainDataPipeJob.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698