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

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

Issue 1610883002: Oilpan: ImageObserver needs to be a GC mixin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl try 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 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 setLoading(false); 90 setLoading(false);
91 setCustomAcceptHeader(); 91 setCustomAcceptHeader();
92 } 92 }
93 93
94 ImageResource::~ImageResource() 94 ImageResource::~ImageResource()
95 { 95 {
96 WTF_LOG(Timers, "~ImageResource %p", this); 96 WTF_LOG(Timers, "~ImageResource %p", this);
97 clearImage(); 97 clearImage();
98 } 98 }
99 99
100 DEFINE_TRACE(ImageResource)
101 {
102 Resource::trace(visitor);
103 ImageObserver::trace(visitor);
104 }
105
100 void ImageResource::load(ResourceFetcher* fetcher, const ResourceLoaderOptions& options) 106 void ImageResource::load(ResourceFetcher* fetcher, const ResourceLoaderOptions& options)
101 { 107 {
102 if (!fetcher || fetcher->autoLoadImages()) 108 if (!fetcher || fetcher->autoLoadImages())
103 Resource::load(fetcher, options); 109 Resource::load(fetcher, options);
104 else 110 else
105 setLoading(false); 111 setLoading(false);
106 } 112 }
107 113
108 void ImageResource::didAddClient(ResourceClient* c) 114 void ImageResource::didAddClient(ResourceClient* c)
109 { 115 {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 277
272 if (m_response.mimeType() == "image/svg+xml") { 278 if (m_response.mimeType() == "image/svg+xml") {
273 m_image = SVGImage::create(this); 279 m_image = SVGImage::create(this);
274 } else { 280 } else {
275 m_image = BitmapImage::create(this); 281 m_image = BitmapImage::create(this);
276 } 282 }
277 } 283 }
278 284
279 inline void ImageResource::clearImage() 285 inline void ImageResource::clearImage()
280 { 286 {
287 if (!m_image)
288 return;
289
281 // If our Image has an observer, it's always us so we need to clear the back pointer 290 // If our Image has an observer, it's always us so we need to clear the back pointer
282 // before dropping our reference. 291 // before dropping our reference.
283 if (m_image) 292 m_image->setImageObserver(nullptr);
284 m_image->setImageObserver(nullptr);
285 m_image.clear(); 293 m_image.clear();
286 } 294 }
287 295
288 void ImageResource::appendData(const char* data, size_t length) 296 void ImageResource::appendData(const char* data, size_t length)
289 { 297 {
290 Resource::appendData(data, length); 298 Resource::appendData(data, length);
291 if (!loadingMultipartContent()) 299 if (!loadingMultipartContent())
292 updateImage(false); 300 updateImage(false);
293 } 301 }
294 302
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return true; 464 return true;
457 return !securityOrigin->taintsCanvas(response().url()); 465 return !securityOrigin->taintsCanvas(response().url());
458 } 466 }
459 467
460 bool ImageResource::loadingMultipartContent() const 468 bool ImageResource::loadingMultipartContent() const
461 { 469 {
462 return m_loader && m_loader->loadingMultipartContent(); 470 return m_loader && m_loader->loadingMultipartContent();
463 } 471 }
464 472
465 } // namespace blink 473 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698