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

Side by Side Diff: Source/core/fetch/MockImageResourceClient.cpp

Issue 1327653004: Have uses of MockImageResourceClient leak less. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clean up MockImageResourceClient somewhat Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « Source/core/fetch/MockImageResourceClient.h ('k') | Source/core/fetch/RawResourceTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/fetch/MockImageResourceClient.h"
7
8 #include "core/fetch/ImageResource.h"
9 #include "core/fetch/ResourcePtr.h"
10
11 #include <gtest/gtest.h>
12
13 namespace blink {
14
15 MockImageResourceClient::MockImageResourceClient(const ResourcePtr<Resource>& re source)
16 : m_resource(resource.get())
17 , m_imageChangedCount(0)
18 , m_notifyFinishedCalled(false)
19 {
20 m_resource->addClient(this);
21 }
22
23 MockImageResourceClient::~MockImageResourceClient()
24 {
25 if (m_resource)
26 m_resource->removeClient(this);
27 }
28
29 void MockImageResourceClient::notifyFinished(Resource*)
30 {
31 ASSERT_FALSE(m_notifyFinishedCalled);
32 m_notifyFinishedCalled = true;
33 }
34
35 void MockImageResourceClient::removeAsClient()
36 {
37 m_resource->removeClient(this);
38 m_resource = nullptr;
39 }
40
41 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fetch/MockImageResourceClient.h ('k') | Source/core/fetch/RawResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698