Index: sky/engine/core/loader/NewImageLoader.h |
diff --git a/sky/engine/core/loader/NewImageLoader.h b/sky/engine/core/loader/NewImageLoader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d02d28aa4d7fa86d8b2676d7d72bc22ca77e92a3 |
--- /dev/null |
+++ b/sky/engine/core/loader/NewImageLoader.h |
@@ -0,0 +1,51 @@ |
+// Copyright 2015 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_CORE_LOADER_NEWIMAGELOADER_H_ |
+#define SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ |
+ |
+#include "mojo/common/data_pipe_drainer.h" |
+#include "sky/engine/platform/SharedBuffer.h" |
+#include "sky/engine/platform/fetcher/MojoFetcher.h" |
+#include "sky/engine/wtf/OwnPtr.h" |
+#include "sky/engine/wtf/PassOwnPtr.h" |
+#include "sky/engine/wtf/text/AtomicString.h" |
+#include "third_party/skia/include/core/SkBitmap.h" |
+ |
+namespace blink { |
+ |
+class NewImageLoaderClient { |
+ public: |
+ virtual void notifyLoadFinished(const SkBitmap& result) = 0; |
abarth-chromium
2015/05/29 23:04:10
I wonder if we should use the "On" pattern of nami
jackson
2015/05/29 23:35:43
Acknowledged.
|
+ |
+ protected: |
+ NewImageLoaderClient() {} |
+}; |
+ |
+class NewImageLoader : public MojoFetcher::Client, |
+ public mojo::common::DataPipeDrainer::Client { |
+ public: |
+ static PassOwnPtr<NewImageLoader> create(NewImageLoaderClient* client) { |
+ return adoptPtr(new NewImageLoader(client)); |
+ } |
abarth-chromium
2015/05/29 23:04:10
Is there a reason to have a |create| function? Wh
jackson
2015/05/29 23:35:44
Acknowledged.
|
+ virtual ~NewImageLoader() {} |
abarth-chromium
2015/05/29 23:04:10
Implementations of virtual functions should be out
jackson
2015/05/29 23:35:44
Acknowledged.
|
+ |
+ void Load(const KURL& src); |
+ |
+ void OnReceivedResponse(mojo::URLResponsePtr); |
+ void OnDataAvailable(const void*, size_t); |
+ void OnDataComplete(); |
abarth-chromium
2015/05/29 23:04:10
Please put the |override| keyword on these virtual
jackson
2015/05/29 23:35:44
Acknowledged.
|
+ |
+ protected: |
abarth-chromium
2015/05/29 23:04:10
Remove?
jackson
2015/05/29 23:35:44
Acknowledged.
|
+ private: |
+ explicit NewImageLoader(NewImageLoaderClient* client) : client_(client) {} |
+ |
+ NewImageLoaderClient* client_; |
+ OwnPtr<MojoFetcher> fetcher_; |
+ OwnPtr<mojo::common::DataPipeDrainer> drainer_; |
+ RefPtr<SharedBuffer> buffer_; |
+}; |
+} |
abarth-chromium
2015/05/29 23:04:10
} // namespace blink
Also, once you make that ch
jackson
2015/05/29 23:35:44
Acknowledged.
|
+ |
+#endif // SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ |