| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "core/fetch/ImageResourceObserver.h" | 34 #include "core/fetch/ImageResourceObserver.h" |
| 35 #include "core/fetch/Resource.h" | 35 #include "core/fetch/Resource.h" |
| 36 #include "core/fetch/ResourceClient.h" | 36 #include "core/fetch/ResourceClient.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class MockResourceClient : public ResourceClient { | 41 class MockResourceClient : public ResourceClient { |
| 42 public: | 42 public: |
| 43 explicit MockResourceClient(const PassRefPtrWillBeRawPtr<Resource>); | 43 explicit MockResourceClient(const RawPtr<Resource>); |
| 44 ~MockResourceClient() override; | 44 ~MockResourceClient() override; |
| 45 | 45 |
| 46 void notifyFinished(Resource*) override; | 46 void notifyFinished(Resource*) override; |
| 47 String debugName() const override { return "MockResourceClient"; } | 47 String debugName() const override { return "MockResourceClient"; } |
| 48 virtual bool notifyFinishedCalled() const { return m_notifyFinishedCalled; } | 48 virtual bool notifyFinishedCalled() const { return m_notifyFinishedCalled; } |
| 49 | 49 |
| 50 virtual void removeAsClient(); | 50 virtual void removeAsClient(); |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 // TODO(Oilpan): properly trace when ResourceClient is on the heap. | 53 // TODO(Oilpan): properly trace when ResourceClient is on the heap. |
| 54 RawPtrWillBeUntracedMember<Resource> m_resource; | 54 UntracedMember<Resource> m_resource; |
| 55 bool m_notifyFinishedCalled; | 55 bool m_notifyFinishedCalled; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class MockImageResourceClient final : public MockResourceClient, public ImageRes
ourceObserver { | 58 class MockImageResourceClient final : public MockResourceClient, public ImageRes
ourceObserver { |
| 59 public: | 59 public: |
| 60 explicit MockImageResourceClient(const PassRefPtrWillBeRawPtr<ImageResource>
); | 60 explicit MockImageResourceClient(const RawPtr<ImageResource>); |
| 61 ~MockImageResourceClient() override; | 61 ~MockImageResourceClient() override; |
| 62 | 62 |
| 63 void imageNotifyFinished(ImageResource*) override; | 63 void imageNotifyFinished(ImageResource*) override; |
| 64 void imageChanged(ImageResource*, const IntRect*) override; | 64 void imageChanged(ImageResource*, const IntRect*) override; |
| 65 | 65 |
| 66 String debugName() const override { return "MockImageResourceClient"; } | 66 String debugName() const override { return "MockImageResourceClient"; } |
| 67 | 67 |
| 68 bool notifyFinishedCalled() const override; | 68 bool notifyFinishedCalled() const override; |
| 69 | 69 |
| 70 void removeAsClient() override; | 70 void removeAsClient() override; |
| 71 | 71 |
| 72 int imageChangedCount() const { return m_imageChangedCount; } | 72 int imageChangedCount() const { return m_imageChangedCount; } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 int m_imageChangedCount; | 75 int m_imageChangedCount; |
| 76 int m_imageNotifyFinishedCount; | 76 int m_imageNotifyFinishedCount; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace blink | 79 } // namespace blink |
| 80 | 80 |
| 81 #endif // MockResourceClients_h | 81 #endif // MockResourceClients_h |
| OLD | NEW |