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

Unified Diff: third_party/WebKit/Source/core/fetch/MockResourceClients.h

Issue 1706083002: Split ImageResourceClient into ResourceClient and ImageResourceObserver [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/MockResourceClients.h
diff --git a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.h b/third_party/WebKit/Source/core/fetch/MockResourceClients.h
similarity index 74%
rename from third_party/WebKit/Source/core/fetch/MockImageResourceClient.h
rename to third_party/WebKit/Source/core/fetch/MockResourceClients.h
index b877a92d9ff2275ef0ea6867f7c282664f971959..6fa5351f9865df3f7db99fe3a981ece75975a3f0 100644
--- a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.h
+++ b/third_party/WebKit/Source/core/fetch/MockResourceClients.h
@@ -28,40 +28,50 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MockImageResourceClient_h
-#define MockImageResourceClient_h
+#ifndef MockResourceClients_h
+#define MockResourceClients_h
-#include "core/fetch/ImageResourceClient.h"
+#include "core/fetch/ImageResourceObserver.h"
#include "core/fetch/Resource.h"
+#include "core/fetch/ResourceClient.h"
#include "platform/heap/Handle.h"
namespace blink {
-class MockImageResourceClient final : public ImageResourceClient {
+class MockResourceClient : public ResourceClient {
public:
- explicit MockImageResourceClient(const PassRefPtrWillBeRawPtr<Resource>);
+ explicit MockResourceClient(const PassRefPtrWillBeRawPtr<Resource>);
+ ~MockResourceClient() override;
+
+ void notifyFinished(Resource*) override;
+ String debugName() const override { return "MockResourceClient"; }
+ bool notifyFinishedCalled() const { return m_notifyFinishedCalled; }
+
+ virtual void removeAsClient();
+
+protected:
+ // TODO(Oilpan): properly trace when ResourceClient is on the heap.
+ RawPtrWillBeUntracedMember<Resource> m_resource;
+ bool m_notifyFinishedCalled;
+};
+
+class MockImageResourceClient final : public MockResourceClient, public ImageResourceObserver {
+public:
+ explicit MockImageResourceClient(const PassRefPtrWillBeRawPtr<ImageResource>);
~MockImageResourceClient() override;
- void imageChanged(ImageResource*, const IntRect*) override
- {
- m_imageChangedCount++;
- }
+ void imageChanged(ImageResource*, const IntRect*) override;
- void notifyFinished(Resource*) override;
String debugName() const override { return "MockImageResourceClient"; }
- int imageChangedCount() const { return m_imageChangedCount; }
- bool notifyFinishedCalled() const { return m_notifyFinishedCalled; }
+ void removeAsClient() override;
- void removeAsClient();
+ int imageChangedCount() const { return m_imageChangedCount; }
private:
- // TODO(Oilpan): properly trace when ImageResourceClient is on the heap.
- RawPtrWillBeUntracedMember<Resource> m_resource;
int m_imageChangedCount;
- bool m_notifyFinishedCalled;
};
} // namespace blink
-#endif // MockImageResourceClient_h
+#endif // MockResourceClients_h

Powered by Google App Engine
This is Rietveld 408576698