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

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

Issue 1213313002: Don't crash when decoding an invalid handle (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | sky/engine/core/loader/CanvasImageDecoder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_ 1 // SKY_ENGINE_CORE_PAINTING_CANVASIMAGE_H_
2 // Copyright 2015 The Chromium Authors. All rights reserved. 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 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #ifndef SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_ 6 #ifndef SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_
7 #define SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_ 7 #define SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_
8 8
9 #include "base/memory/weak_ptr.h"
9 #include "mojo/common/data_pipe_drainer.h" 10 #include "mojo/common/data_pipe_drainer.h"
10 #include "sky/engine/core/loader/ImageDecoderCallback.h" 11 #include "sky/engine/core/loader/ImageDecoderCallback.h"
11 #include "sky/engine/platform/SharedBuffer.h" 12 #include "sky/engine/platform/SharedBuffer.h"
12 #include "sky/engine/tonic/dart_wrappable.h" 13 #include "sky/engine/tonic/dart_wrappable.h"
13 #include "sky/engine/wtf/OwnPtr.h" 14 #include "sky/engine/wtf/OwnPtr.h"
14 #include "sky/engine/wtf/text/AtomicString.h" 15 #include "sky/engine/wtf/text/AtomicString.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 class CanvasImageDecoder : public mojo::common::DataPipeDrainer::Client, 19 class CanvasImageDecoder : public mojo::common::DataPipeDrainer::Client,
19 public RefCounted<CanvasImageDecoder>, 20 public RefCounted<CanvasImageDecoder>,
20 public DartWrappable { 21 public DartWrappable {
21 DEFINE_WRAPPERTYPEINFO(); 22 DEFINE_WRAPPERTYPEINFO();
22 public: 23 public:
23 static PassRefPtr<CanvasImageDecoder> create(mojo::ScopedDataPipeConsumerHandl e handle, PassOwnPtr<ImageDecoderCallback> callback); 24 static PassRefPtr<CanvasImageDecoder> create(mojo::ScopedDataPipeConsumerHandl e handle, PassOwnPtr<ImageDecoderCallback> callback);
24 virtual ~CanvasImageDecoder(); 25 virtual ~CanvasImageDecoder();
25 26
26 // mojo::common::DataPipeDrainer::Client 27 // mojo::common::DataPipeDrainer::Client
27 void OnDataAvailable(const void*, size_t) override; 28 void OnDataAvailable(const void*, size_t) override;
28 void OnDataComplete() override; 29 void OnDataComplete() override;
29 30
30 private: 31 private:
31 CanvasImageDecoder(mojo::ScopedDataPipeConsumerHandle handle, PassOwnPtr<Image DecoderCallback> callback); 32 CanvasImageDecoder(mojo::ScopedDataPipeConsumerHandle handle, PassOwnPtr<Image DecoderCallback> callback);
32 33
34 void RejectCallback();
35
33 OwnPtr<mojo::common::DataPipeDrainer> drainer_; 36 OwnPtr<mojo::common::DataPipeDrainer> drainer_;
34 RefPtr<SharedBuffer> buffer_; 37 RefPtr<SharedBuffer> buffer_;
35 OwnPtr<ImageDecoderCallback> callback_; 38 OwnPtr<ImageDecoderCallback> callback_;
39
40 base::WeakPtrFactory<CanvasImageDecoder> weak_factory_;
36 }; 41 };
37 42
38 } // namespace blink 43 } // namespace blink
39 44
40 #endif // SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_ 45 #endif // SKY_ENGINE_CORE_LOADER_CANVASIMAGELOADER_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/loader/CanvasImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698