| 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 MojoLoader_h | 5 #ifndef MojoLoader_h |
| 6 #define MojoLoader_h | 6 #define MojoLoader_h |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "mojo/common/handle_watcher.h" | 9 #include "mojo/common/handle_watcher.h" |
| 10 #include "mojo/public/cpp/system/data_pipe.h" | 10 #include "mojo/public/cpp/system/data_pipe.h" |
| 11 #include "platform/fetcher/DrainDataPipeJob.h" |
| 11 #include "platform/weborigin/KURL.h" | 12 #include "platform/weborigin/KURL.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class LocalFrame; | 16 class LocalFrame; |
| 16 | 17 |
| 17 class MojoLoader { | 18 class MojoLoader : public DrainDataPipeJob::Client { |
| 18 public: | 19 public: |
| 19 explicit MojoLoader(LocalFrame&); | 20 explicit MojoLoader(LocalFrame&); |
| 20 | 21 |
| 21 void load(const KURL&, mojo::ScopedDataPipeConsumerHandle); | 22 void load(const KURL&, mojo::ScopedDataPipeConsumerHandle); |
| 22 | 23 |
| 23 private: | 24 private: |
| 24 LocalFrame& m_frame; | 25 LocalFrame& m_frame; |
| 25 | 26 |
| 26 // FIXME: These belong on a helper object for async reading from mojo pipes. | 27 // From DrainDataPipeJob::Client |
| 27 void readMore(); | 28 void OnDataAvailable(const void* data, size_t numberOfBytes) override; |
| 28 void waitToReadMore(); | 29 void OnDataComplete() override; |
| 29 void moreDataReady(MojoResult); | |
| 30 | 30 |
| 31 mojo::common::HandleWatcher m_handleWatcher; | 31 OwnPtr<DrainDataPipeJob> m_drainJob; |
| 32 mojo::ScopedDataPipeConsumerHandle m_responseStream; | |
| 33 base::WeakPtrFactory<MojoLoader> m_weakFactory; | |
| 34 }; | 32 }; |
| 35 | 33 |
| 36 } | 34 } |
| 37 | 35 |
| 38 #endif | 36 #endif |
| OLD | NEW |