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

Side by Side Diff: sky/engine/core/loader/CanvasImageLoader.h

Issue 1156003007: Refactor image handling in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Catch errors in example Created 5 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_
2 // Copyright 2015 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_
7 #define SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_
8
9 #include "mojo/common/data_pipe_drainer.h"
10 #include "sky/engine/core/loader/ImageLoaderCallback.h"
11 #include "sky/engine/platform/SharedBuffer.h"
12 #include "sky/engine/platform/fetcher/MojoFetcher.h"
13 #include "sky/engine/tonic/dart_wrappable.h"
14 #include "sky/engine/wtf/OwnPtr.h"
15 #include "sky/engine/wtf/text/AtomicString.h"
16
17 namespace blink {
18
19 class CanvasImageLoader : public MojoFetcher::Client,
20 public mojo::common::DataPipeDrainer::Client,
21 public RefCounted<CanvasImageLoader>,
22 public DartWrappable {
23 DEFINE_WRAPPERTYPEINFO();
24 public:
25 static PassRefPtr<CanvasImageLoader> create() { return adoptRef(new CanvasImag eLoader); }
26 virtual ~CanvasImageLoader();
27
28 void load(const String& src, PassOwnPtr<ImageLoaderCallback> callback);
29
30 // MojoFetcher::Client
31 void OnReceivedResponse(mojo::URLResponsePtr) override;
32
33 // mojo::common::DataPipeDrainer::Client
34 void OnDataAvailable(const void*, size_t) override;
35 void OnDataComplete() override;
36
37 private:
38 explicit CanvasImageLoader();
39
40 OwnPtr<MojoFetcher> fetcher_;
41 OwnPtr<mojo::common::DataPipeDrainer> drainer_;
42 RefPtr<SharedBuffer> buffer_;
43 OwnPtr<ImageLoaderCallback> callback_;
44 };
45
46 } // namespace blink
47
48 #endif // SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698