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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleFetchedImage.cpp

Issue 2486073004: [ImageResource 1a] Change StyleFetchedImage from ResourceClient to ImageResourceObserver (Closed)
Patch Set: Rebase 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
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleFetchedImage.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 18 matching lines...) Expand all
29 #include "core/svg/graphics/SVGImage.h" 29 #include "core/svg/graphics/SVGImage.h"
30 #include "core/svg/graphics/SVGImageForContainer.h" 30 #include "core/svg/graphics/SVGImageForContainer.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 StyleFetchedImage::StyleFetchedImage(ImageResource* image, 34 StyleFetchedImage::StyleFetchedImage(ImageResource* image,
35 const Document& document, 35 const Document& document,
36 const KURL& url) 36 const KURL& url)
37 : m_image(image), m_document(&document), m_url(url) { 37 : m_image(image), m_document(&document), m_url(url) {
38 m_isImageResource = true; 38 m_isImageResource = true;
39 m_image->addClient(this); 39 m_image->addObserver(this);
40 // ResourceFetcher is not determined from StyleFetchedImage and it is 40 // ResourceFetcher is not determined from StyleFetchedImage and it is
41 // impossible to send a request for refetching. 41 // impossible to send a request for refetching.
42 m_image->setNotRefetchableDataFromDiskCache(); 42 m_image->setNotRefetchableDataFromDiskCache();
43 ThreadState::current()->registerPreFinalizer(this); 43 ThreadState::current()->registerPreFinalizer(this);
44 } 44 }
45 45
46 StyleFetchedImage::~StyleFetchedImage() {} 46 StyleFetchedImage::~StyleFetchedImage() {}
47 47
48 void StyleFetchedImage::dispose() { 48 void StyleFetchedImage::dispose() {
49 m_image->removeClient(this); 49 m_image->removeObserver(this);
50 m_image = nullptr; 50 m_image = nullptr;
51 } 51 }
52 52
53 WrappedImagePtr StyleFetchedImage::data() const { 53 WrappedImagePtr StyleFetchedImage::data() const {
54 return m_image.get(); 54 return m_image.get();
55 } 55 }
56 56
57 ImageResource* StyleFetchedImage::cachedImage() const { 57 ImageResource* StyleFetchedImage::cachedImage() const {
58 return m_image.get(); 58 return m_image.get();
59 } 59 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 void StyleFetchedImage::addClient(LayoutObject* layoutObject) { 105 void StyleFetchedImage::addClient(LayoutObject* layoutObject) {
106 m_image->addObserver(layoutObject); 106 m_image->addObserver(layoutObject);
107 } 107 }
108 108
109 void StyleFetchedImage::removeClient(LayoutObject* layoutObject) { 109 void StyleFetchedImage::removeClient(LayoutObject* layoutObject) {
110 m_image->removeObserver(layoutObject); 110 m_image->removeObserver(layoutObject);
111 } 111 }
112 112
113 void StyleFetchedImage::notifyFinished(Resource* resource) { 113 void StyleFetchedImage::imageNotifyFinished(ImageResource*) {
114 if (m_document && m_image && m_image->getImage() && 114 if (m_document && m_image && m_image->getImage() &&
115 m_image->getImage()->isSVGImage()) 115 m_image->getImage()->isSVGImage())
116 toSVGImage(m_image->getImage())->updateUseCounters(*m_document); 116 toSVGImage(m_image->getImage())->updateUseCounters(*m_document);
117 // Oilpan: do not prolong the Document's lifetime. 117 // Oilpan: do not prolong the Document's lifetime.
118 m_document.clear(); 118 m_document.clear();
119 } 119 }
120 120
121 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject&, 121 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject&,
122 const IntSize& containerSize, 122 const IntSize& containerSize,
123 float zoom) const { 123 float zoom) const {
(...skipping 10 matching lines...) Expand all
134 "data", 134 "data",
135 InspectorPaintImageEvent::data(&layoutObject, *m_image.get())); 135 InspectorPaintImageEvent::data(&layoutObject, *m_image.get()));
136 return m_image->getImage()->currentFrameKnownToBeOpaque( 136 return m_image->getImage()->currentFrameKnownToBeOpaque(
137 Image::PreCacheMetadata); 137 Image::PreCacheMetadata);
138 } 138 }
139 139
140 DEFINE_TRACE(StyleFetchedImage) { 140 DEFINE_TRACE(StyleFetchedImage) {
141 visitor->trace(m_image); 141 visitor->trace(m_image);
142 visitor->trace(m_document); 142 visitor->trace(m_document);
143 StyleImage::trace(visitor); 143 StyleImage::trace(visitor);
144 ResourceClient::trace(visitor);
145 } 144 }
146 145
147 } // namespace blink 146 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleFetchedImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698