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

Side by Side Diff: third_party/WebKit/Source/core/fetch/MockResourceClients.h

Issue 2527353002: Phase II Step 3: Reload LoFi/placeholder images via new ImageResource
Patch Set: tests Created 4 years 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 unified diff | Download patch
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 String debugName() const override { return "MockResourceClient"; } 53 String debugName() const override { return "MockResourceClient"; }
54 virtual bool notifyFinishedCalled() const { return m_notifyFinishedCalled; } 54 virtual bool notifyFinishedCalled() const { return m_notifyFinishedCalled; }
55 55
56 size_t encodedSizeOnNotifyFinished() const { 56 size_t encodedSizeOnNotifyFinished() const {
57 return m_encodedSizeOnNotifyFinished; 57 return m_encodedSizeOnNotifyFinished;
58 } 58 }
59 59
60 virtual void removeAsClient(); 60 virtual void removeAsClient();
61 virtual void dispose(); 61 virtual void dispose();
62 62
63 DECLARE_TRACE(); 63 DECLARE_VIRTUAL_TRACE();
64 64
65 protected: 65 protected:
66 Member<Resource> m_resource; 66 Member<Resource> m_resource;
67 bool m_notifyFinishedCalled; 67 bool m_notifyFinishedCalled;
68 size_t m_encodedSizeOnNotifyFinished; 68 size_t m_encodedSizeOnNotifyFinished;
69 }; 69 };
70 70
71 // MockImageResourceClient isn't re-registered to the new ImageResource
72 // in LoFi image reloading.
71 class MockImageResourceClient final : public MockResourceClient, 73 class MockImageResourceClient final : public MockResourceClient,
72 public ImageResourceObserver { 74 public ImageResourceObserver {
73 public: 75 public:
74 explicit MockImageResourceClient(ImageResource*); 76 explicit MockImageResourceClient(ImageResource*);
75 ~MockImageResourceClient() override; 77 ~MockImageResourceClient() override;
76 78
77 void imageNotifyFinished(ImageResourceContent*) override; 79 void imageNotifyFinished(ImageResourceContent*) override;
78 void imageChanged(ImageResourceContent*, const IntRect*) override; 80 void imageChanged(ImageResourceContent*, const IntRect*) override;
79 81
80 String debugName() const override { return "MockImageResourceClient"; } 82 String debugName() const override { return "MockImageResourceClient"; }
81 83
82 bool notifyFinishedCalled() const override; 84 bool notifyFinishedCalled() const override;
83 85
84 void removeAsClient() override; 86 void removeAsClientAndObserver();
85 void dispose() override; 87 void dispose() override;
86 88
87 int imageChangedCount() const { return m_imageChangedCount; } 89 int imageChangedCount() const { return m_imageChangedCount; }
88 int imageNotifyFinishedCount() const { return m_imageNotifyFinishedCount; } 90 int imageNotifyFinishedCount() const { return m_imageNotifyFinishedCount; }
89 91
90 size_t encodedSizeOnLastImageChanged() const { 92 size_t encodedSizeOnLastImageChanged() const {
91 return m_encodedSizeOnLastImageChanged; 93 return m_encodedSizeOnLastImageChanged;
92 } 94 }
93 size_t encodedSizeOnImageNotifyFinished() const { 95 size_t encodedSizeOnImageNotifyFinished() const {
94 return m_encodedSizeOnImageNotifyFinished; 96 return m_encodedSizeOnImageNotifyFinished;
95 } 97 }
96 98
99 DEFINE_INLINE_VIRTUAL_TRACE() {
100 visitor->trace(m_content);
101 MockResourceClient::trace(visitor);
102 }
103
97 private: 104 private:
98 int m_imageChangedCount; 105 int m_imageChangedCount;
99 size_t m_encodedSizeOnLastImageChanged; 106 size_t m_encodedSizeOnLastImageChanged;
100 int m_imageNotifyFinishedCount; 107 int m_imageNotifyFinishedCount;
101 size_t m_encodedSizeOnImageNotifyFinished; 108 size_t m_encodedSizeOnImageNotifyFinished;
109 Member<ImageResourceContent> m_content;
102 }; 110 };
103 111
104 } // namespace blink 112 } // namespace blink
105 113
106 #endif // MockResourceClients_h 114 #endif // MockResourceClients_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698