OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef MockImageResourceClient_h | 31 #ifndef MockImageResourceClient_h |
32 #define MockImageResourceClient_h | 32 #define MockImageResourceClient_h |
33 | 33 |
34 #include "core/fetch/ImageResourceClient.h" | 34 #include "core/fetch/ImageResourceClient.h" |
| 35 #include "core/fetch/Resource.h" |
35 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 template<typename T> class ResourcePtr; | |
40 | |
41 class Resource; | |
42 | |
43 class MockImageResourceClient final : public ImageResourceClient { | 40 class MockImageResourceClient final : public ImageResourceClient { |
44 public: | 41 public: |
45 explicit MockImageResourceClient(const ResourcePtr<Resource>&); | 42 explicit MockImageResourceClient(const PassRefPtrWillBeRawPtr<Resource>); |
46 ~MockImageResourceClient() override; | 43 ~MockImageResourceClient() override; |
47 | 44 |
48 void imageChanged(ImageResource*, const IntRect*) override | 45 void imageChanged(ImageResource*, const IntRect*) override |
49 { | 46 { |
50 m_imageChangedCount++; | 47 m_imageChangedCount++; |
51 } | 48 } |
52 | 49 |
53 void notifyFinished(Resource*) override; | 50 void notifyFinished(Resource*) override; |
54 String debugName() const override { return "MockImageResourceClient"; } | 51 String debugName() const override { return "MockImageResourceClient"; } |
55 | 52 |
56 int imageChangedCount() const { return m_imageChangedCount; } | 53 int imageChangedCount() const { return m_imageChangedCount; } |
57 bool notifyFinishedCalled() const { return m_notifyFinishedCalled; } | 54 bool notifyFinishedCalled() const { return m_notifyFinishedCalled; } |
58 | 55 |
59 void removeAsClient(); | 56 void removeAsClient(); |
60 | 57 |
61 private: | 58 private: |
62 // TODO(Oilpan): properly trace when ImageResourceClient is on the heap. | 59 // TODO(Oilpan): properly trace when ImageResourceClient is on the heap. |
63 RawPtrWillBeUntracedMember<Resource> m_resource; | 60 RawPtrWillBeUntracedMember<Resource> m_resource; |
64 int m_imageChangedCount; | 61 int m_imageChangedCount; |
65 bool m_notifyFinishedCalled; | 62 bool m_notifyFinishedCalled; |
66 }; | 63 }; |
67 | 64 |
68 } // namespace blink | 65 } // namespace blink |
69 | 66 |
70 #endif // MockImageResourceClient_h | 67 #endif // MockImageResourceClient_h |
OLD | NEW |