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

Unified Diff: third_party/WebKit/Source/core/loader/resource/MockImageResourceObserver.h

Issue 2607023002: Replace MockImageResourceClient with MockImageResourceObserver (Closed)
Patch Set: Rebase Created 3 years, 11 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/loader/resource/MockImageResourceObserver.h
diff --git a/third_party/WebKit/Source/core/loader/resource/MockImageResourceClient.h b/third_party/WebKit/Source/core/loader/resource/MockImageResourceObserver.h
similarity index 40%
rename from third_party/WebKit/Source/core/loader/resource/MockImageResourceClient.h
rename to third_party/WebKit/Source/core/loader/resource/MockImageResourceObserver.h
index 9a16d55df7e8241cc953eaea57804d82d401f5d1..0fdabb1148545ff945d3f3281f95bc716beb4bd2 100644
--- a/third_party/WebKit/Source/core/loader/resource/MockImageResourceClient.h
+++ b/third_party/WebKit/Source/core/loader/resource/MockImageResourceObserver.h
@@ -2,49 +2,51 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MockImageResourceClient_h
-#define MockImageResourceClient_h
+#ifndef MockImageResourceObserver_h
+#define MockImageResourceObserver_h
-#include "core/fetch/MockResourceClient.h"
#include "core/loader/resource/ImageResource.h"
#include "core/loader/resource/ImageResourceContent.h"
#include "core/loader/resource/ImageResourceObserver.h"
+#include <memory>
namespace blink {
-class MockImageResourceClient final : public MockResourceClient,
- public ImageResourceObserver {
+class MockImageResourceObserver final : public ImageResourceObserver {
public:
- explicit MockImageResourceClient(ImageResource*);
- ~MockImageResourceClient() override;
-
- void imageNotifyFinished(ImageResourceContent*) override;
- void imageChanged(ImageResourceContent*, const IntRect*) override;
-
- String debugName() const override { return "MockImageResourceClient"; }
-
- bool notifyFinishedCalled() const override;
+ static std::unique_ptr<MockImageResourceObserver> create(
+ ImageResourceContent* content) {
+ return WTF::wrapUnique(new MockImageResourceObserver(content));
+ }
+ ~MockImageResourceObserver() override;
- void removeAsClient() override;
- void dispose() override;
+ void removeAsObserver();
int imageChangedCount() const { return m_imageChangedCount; }
- int imageNotifyFinishedCount() const { return m_imageNotifyFinishedCount; }
+ bool imageNotifyFinishedCalled() const;
- size_t encodedSizeOnLastImageChanged() const {
- return m_encodedSizeOnLastImageChanged;
+ int imageWidthOnLastImageChanged() const {
+ return m_imageWidthOnLastImageChanged;
}
- size_t encodedSizeOnImageNotifyFinished() const {
- return m_encodedSizeOnImageNotifyFinished;
+ int imageWidthOnImageNotifyFinished() const {
+ return m_imageWidthOnImageNotifyFinished;
}
private:
+ explicit MockImageResourceObserver(ImageResourceContent*);
+
+ // ImageResourceObserver overrides.
+ void imageNotifyFinished(ImageResourceContent*) override;
+ void imageChanged(ImageResourceContent*, const IntRect*) override;
+ String debugName() const override { return "MockImageResourceObserver"; }
+
+ Persistent<ImageResourceContent> m_content;
int m_imageChangedCount;
- size_t m_encodedSizeOnLastImageChanged;
+ int m_imageWidthOnLastImageChanged;
int m_imageNotifyFinishedCount;
- size_t m_encodedSizeOnImageNotifyFinished;
+ int m_imageWidthOnImageNotifyFinished;
};
} // namespace blink
-#endif // MockImageResourceClient_h
+#endif // MockImageResourceObserver_h

Powered by Google App Engine
This is Rietveld 408576698