Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ | |
| 6 #define SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ | |
| 7 | |
| 8 #include "mojo/common/data_pipe_drainer.h" | |
| 9 #include "sky/engine/platform/SharedBuffer.h" | |
| 10 #include "sky/engine/platform/fetcher/MojoFetcher.h" | |
| 11 #include "sky/engine/wtf/OwnPtr.h" | |
| 12 #include "sky/engine/wtf/PassOwnPtr.h" | |
| 13 #include "sky/engine/wtf/text/AtomicString.h" | |
| 14 #include "third_party/skia/include/core/SkBitmap.h" | |
| 15 | |
| 16 namespace blink { | |
| 17 | |
| 18 class NewImageLoaderClient { | |
| 19 public: | |
| 20 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.
| |
| 21 | |
| 22 protected: | |
| 23 NewImageLoaderClient() {} | |
| 24 }; | |
| 25 | |
| 26 class NewImageLoader : public MojoFetcher::Client, | |
| 27 public mojo::common::DataPipeDrainer::Client { | |
| 28 public: | |
| 29 static PassOwnPtr<NewImageLoader> create(NewImageLoaderClient* client) { | |
| 30 return adoptPtr(new NewImageLoader(client)); | |
| 31 } | |
|
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.
| |
| 32 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.
| |
| 33 | |
| 34 void Load(const KURL& src); | |
| 35 | |
| 36 void OnReceivedResponse(mojo::URLResponsePtr); | |
| 37 void OnDataAvailable(const void*, size_t); | |
| 38 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.
| |
| 39 | |
| 40 protected: | |
|
abarth-chromium
2015/05/29 23:04:10
Remove?
jackson
2015/05/29 23:35:44
Acknowledged.
| |
| 41 private: | |
| 42 explicit NewImageLoader(NewImageLoaderClient* client) : client_(client) {} | |
| 43 | |
| 44 NewImageLoaderClient* client_; | |
| 45 OwnPtr<MojoFetcher> fetcher_; | |
| 46 OwnPtr<mojo::common::DataPipeDrainer> drainer_; | |
| 47 RefPtr<SharedBuffer> buffer_; | |
| 48 }; | |
| 49 } | |
|
abarth-chromium
2015/05/29 23:04:10
} // namespace blink
Also, once you make that ch
jackson
2015/05/29 23:35:44
Acknowledged.
| |
| 50 | |
| 51 #endif // SKY_ENGINE_CORE_LOADER_NEWIMAGELOADER_H_ | |
| OLD | NEW |