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

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

Issue 2559703002: Loading: split MockResourceClients into multiple files type by type (Closed)
Patch Set: [rebase to trunk] 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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef MockResourceClients_h 31 #ifndef MockResourceClient_h
32 #define MockResourceClients_h 32 #define MockResourceClient_h
33 33
34 #include "core/fetch/ImageResource.h"
35 #include "core/fetch/ImageResourceContent.h"
36 #include "core/fetch/ImageResourceObserver.h"
37 #include "core/fetch/Resource.h" 34 #include "core/fetch/Resource.h"
38 #include "core/fetch/ResourceClient.h" 35 #include "core/fetch/ResourceClient.h"
39 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
40 37
41 namespace blink { 38 namespace blink {
42 39
43 class MockResourceClient : public GarbageCollectedFinalized<MockResourceClient>, 40 class MockResourceClient : public GarbageCollectedFinalized<MockResourceClient>,
44 public ResourceClient { 41 public ResourceClient {
45 USING_PRE_FINALIZER(MockResourceClient, dispose); 42 USING_PRE_FINALIZER(MockResourceClient, dispose);
46 USING_GARBAGE_COLLECTED_MIXIN(MockResourceClient); 43 USING_GARBAGE_COLLECTED_MIXIN(MockResourceClient);
(...skipping 14 matching lines...) Expand all
61 virtual void dispose(); 58 virtual void dispose();
62 59
63 DECLARE_TRACE(); 60 DECLARE_TRACE();
64 61
65 protected: 62 protected:
66 Member<Resource> m_resource; 63 Member<Resource> m_resource;
67 bool m_notifyFinishedCalled; 64 bool m_notifyFinishedCalled;
68 size_t m_encodedSizeOnNotifyFinished; 65 size_t m_encodedSizeOnNotifyFinished;
69 }; 66 };
70 67
71 class MockImageResourceClient final : public MockResourceClient,
72 public ImageResourceObserver {
73 public:
74 explicit MockImageResourceClient(ImageResource*);
75 ~MockImageResourceClient() override;
76
77 void imageNotifyFinished(ImageResourceContent*) override;
78 void imageChanged(ImageResourceContent*, const IntRect*) override;
79
80 String debugName() const override { return "MockImageResourceClient"; }
81
82 bool notifyFinishedCalled() const override;
83
84 void removeAsClient() override;
85 void dispose() override;
86
87 int imageChangedCount() const { return m_imageChangedCount; }
88 int imageNotifyFinishedCount() const { return m_imageNotifyFinishedCount; }
89
90 size_t encodedSizeOnLastImageChanged() const {
91 return m_encodedSizeOnLastImageChanged;
92 }
93 size_t encodedSizeOnImageNotifyFinished() const {
94 return m_encodedSizeOnImageNotifyFinished;
95 }
96
97 private:
98 int m_imageChangedCount;
99 size_t m_encodedSizeOnLastImageChanged;
100 int m_imageNotifyFinishedCount;
101 size_t m_encodedSizeOnImageNotifyFinished;
102 };
103
104 } // namespace blink 68 } // namespace blink
105 69
106 #endif // MockResourceClients_h 70 #endif // MockResourceClient_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698