| OLD | NEW |
| (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 "platform/loader/fetch/MockResourceClient.h" | |
| 6 | |
| 7 namespace blink { | |
| 8 | |
| 9 MockResourceClient::MockResourceClient(Resource* resource) | |
| 10 : m_resource(resource), | |
| 11 m_notifyFinishedCalled(false), | |
| 12 m_encodedSizeOnNotifyFinished(0) { | |
| 13 m_resource->addClient(this); | |
| 14 } | |
| 15 | |
| 16 MockResourceClient::~MockResourceClient() {} | |
| 17 | |
| 18 void MockResourceClient::notifyFinished(Resource* resource) { | |
| 19 CHECK(!m_notifyFinishedCalled); | |
| 20 m_notifyFinishedCalled = true; | |
| 21 m_encodedSizeOnNotifyFinished = resource->encodedSize(); | |
| 22 } | |
| 23 | |
| 24 void MockResourceClient::removeAsClient() { | |
| 25 m_resource->removeClient(this); | |
| 26 m_resource = nullptr; | |
| 27 } | |
| 28 | |
| 29 void MockResourceClient::dispose() { | |
| 30 if (m_resource) { | |
| 31 m_resource->removeClient(this); | |
| 32 m_resource = nullptr; | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 DEFINE_TRACE(MockResourceClient) { | |
| 37 visitor->trace(m_resource); | |
| 38 ResourceClient::trace(visitor); | |
| 39 } | |
| 40 | |
| 41 } // namespace blink | |
| OLD | NEW |