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

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

Issue 1667843003: Make Resource RefCountedWillBeGarbageCollectedFinalized, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + address review comments Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/fetch/MockImageResourceClient.h" 5 #include "core/fetch/MockImageResourceClient.h"
6 6
7 #include "core/fetch/ImageResource.h" 7 #include "core/fetch/ImageResource.h"
8 #include "core/fetch/ResourcePtr.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 9
11 namespace blink { 10 namespace blink {
12 11
13 MockImageResourceClient::MockImageResourceClient(const ResourcePtr<Resource>& re source) 12 MockImageResourceClient::MockImageResourceClient(PassRefPtrWillBeRawPtr<Resource > resource)
14 : m_resource(resource.get()) 13 : m_resource(resource.get())
15 , m_imageChangedCount(0) 14 , m_imageChangedCount(0)
16 , m_notifyFinishedCalled(false) 15 , m_notifyFinishedCalled(false)
17 { 16 {
18 m_resource->addClient(this); 17 m_resource->addClient(this);
19 } 18 }
20 19
21 MockImageResourceClient::~MockImageResourceClient() 20 MockImageResourceClient::~MockImageResourceClient()
22 { 21 {
23 if (m_resource) 22 if (m_resource)
24 m_resource->removeClient(this); 23 m_resource->removeClient(this);
25 } 24 }
26 25
27 void MockImageResourceClient::notifyFinished(Resource*) 26 void MockImageResourceClient::notifyFinished(Resource*)
28 { 27 {
29 ASSERT_FALSE(m_notifyFinishedCalled); 28 ASSERT_FALSE(m_notifyFinishedCalled);
30 m_notifyFinishedCalled = true; 29 m_notifyFinishedCalled = true;
31 } 30 }
32 31
33 void MockImageResourceClient::removeAsClient() 32 void MockImageResourceClient::removeAsClient()
34 { 33 {
35 m_resource->removeClient(this); 34 m_resource->removeClient(this);
36 m_resource = nullptr; 35 m_resource = nullptr;
37 } 36 }
38 37
39 } // namespace blink 38 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MockImageResourceClient.h ('k') | third_party/WebKit/Source/core/fetch/RawResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698