Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MockImageResourceClient_h | 5 #ifndef MockImageResourceClient_h |
| 6 #define MockImageResourceClient_h | 6 #define MockImageResourceClient_h |
| 7 | 7 |
| 8 #include "core/fetch/MockResourceClient.h" | 8 #include "core/fetch/MockResourceClient.h" |
| 9 #include "core/loader/resource/ImageResource.h" | 9 #include "core/loader/resource/ImageResource.h" |
| 10 #include "core/loader/resource/ImageResourceContent.h" | 10 #include "core/loader/resource/ImageResourceContent.h" |
| 11 #include "core/loader/resource/ImageResourceObserver.h" | 11 #include "core/loader/resource/ImageResourceObserver.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 // MockImageResourceClient isn't re-registered to the new ImageResource | |
| 16 // in LoFi image reloading. | |
|
Nate Chapin
2016/12/28 00:14:58
This seems like it's going to trip someone up at s
hiroshige
2017/01/25 02:01:49
I replaced MockImageResourceClient with MockImageR
| |
| 15 class MockImageResourceClient final : public MockResourceClient, | 17 class MockImageResourceClient final : public MockResourceClient, |
| 16 public ImageResourceObserver { | 18 public ImageResourceObserver { |
| 17 public: | 19 public: |
| 18 explicit MockImageResourceClient(ImageResource*); | 20 explicit MockImageResourceClient(ImageResource*); |
| 19 ~MockImageResourceClient() override; | 21 ~MockImageResourceClient() override; |
| 20 | 22 |
| 21 void imageNotifyFinished(ImageResourceContent*) override; | 23 void imageNotifyFinished(ImageResourceContent*) override; |
| 22 void imageChanged(ImageResourceContent*, const IntRect*) override; | 24 void imageChanged(ImageResourceContent*, const IntRect*) override; |
| 23 | 25 |
| 24 String debugName() const override { return "MockImageResourceClient"; } | 26 String debugName() const override { return "MockImageResourceClient"; } |
| 25 | 27 |
| 26 bool notifyFinishedCalled() const override; | 28 bool notifyFinishedCalled() const override; |
| 27 | 29 |
| 28 void removeAsClient() override; | 30 void removeAsClientAndObserver(); |
| 29 void dispose() override; | 31 void dispose() override; |
| 30 | 32 |
| 31 int imageChangedCount() const { return m_imageChangedCount; } | 33 int imageChangedCount() const { return m_imageChangedCount; } |
| 32 int imageNotifyFinishedCount() const { return m_imageNotifyFinishedCount; } | 34 int imageNotifyFinishedCount() const { return m_imageNotifyFinishedCount; } |
| 33 | 35 |
| 34 size_t encodedSizeOnLastImageChanged() const { | 36 size_t encodedSizeOnLastImageChanged() const { |
| 35 return m_encodedSizeOnLastImageChanged; | 37 return m_encodedSizeOnLastImageChanged; |
| 36 } | 38 } |
| 37 size_t encodedSizeOnImageNotifyFinished() const { | 39 size_t encodedSizeOnImageNotifyFinished() const { |
| 38 return m_encodedSizeOnImageNotifyFinished; | 40 return m_encodedSizeOnImageNotifyFinished; |
| 39 } | 41 } |
| 40 | 42 |
| 43 DEFINE_INLINE_VIRTUAL_TRACE() { | |
| 44 visitor->trace(m_content); | |
| 45 MockResourceClient::trace(visitor); | |
| 46 } | |
| 47 | |
| 41 private: | 48 private: |
| 42 int m_imageChangedCount; | 49 int m_imageChangedCount; |
| 43 size_t m_encodedSizeOnLastImageChanged; | 50 size_t m_encodedSizeOnLastImageChanged; |
| 44 int m_imageNotifyFinishedCount; | 51 int m_imageNotifyFinishedCount; |
| 45 size_t m_encodedSizeOnImageNotifyFinished; | 52 size_t m_encodedSizeOnImageNotifyFinished; |
| 53 Member<ImageResourceContent> m_content; | |
| 46 }; | 54 }; |
| 47 | 55 |
| 48 } // namespace blink | 56 } // namespace blink |
| 49 | 57 |
| 50 #endif // MockImageResourceClient_h | 58 #endif // MockImageResourceClient_h |
| OLD | NEW |