Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 116 |
| 117 void ImageResource::addObserver(ImageResourceObserver* observer) | 117 void ImageResource::addObserver(ImageResourceObserver* observer) |
| 118 { | 118 { |
| 119 willAddClientOrObserver(); | 119 willAddClientOrObserver(); |
| 120 | 120 |
| 121 m_observers.add(observer); | 121 m_observers.add(observer); |
| 122 | 122 |
| 123 if (isCacheValidator()) | 123 if (isCacheValidator()) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 if (m_data && !m_image && !errorOccurred()) { | |
| 127 createImage(); | |
| 128 m_image->setData(m_data, true); | |
| 129 } | |
| 130 | |
|
hajimehoshi
2016/06/10 13:30:28
I think it is safe to remove since this was introd
hiroshige
2016/06/15 13:27:01
So can we add
|CHECK(!m_data || m_image)|
here?
hajimehoshi
2016/06/17 09:25:15
Done.
| |
| 131 if (m_image && !m_image->isNull()) { | 126 if (m_image && !m_image->isNull()) { |
| 132 observer->imageChanged(this); | 127 observer->imageChanged(this); |
| 133 } | 128 } |
| 134 | 129 |
| 135 if (isLoaded()) { | 130 if (isLoaded()) { |
| 136 observer->imageNotifyFinished(this); | 131 observer->imageNotifyFinished(this); |
| 137 if (m_observers.contains(observer)) { | 132 if (m_observers.contains(observer)) { |
| 138 m_finishedObservers.add(observer); | 133 m_finishedObservers.add(observer); |
| 139 m_observers.remove(observer); | 134 m_observers.remove(observer); |
| 140 } | 135 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 m_data.clear(); | 379 m_data.clear(); |
| 385 } | 380 } |
| 386 | 381 |
| 387 void ImageResource::finish(double loadFinishTime) | 382 void ImageResource::finish(double loadFinishTime) |
| 388 { | 383 { |
| 389 if (m_multipartParser) { | 384 if (m_multipartParser) { |
| 390 m_multipartParser->finish(); | 385 m_multipartParser->finish(); |
| 391 if (m_data) | 386 if (m_data) |
| 392 updateImageAndClearBuffer(); | 387 updateImageAndClearBuffer(); |
| 393 } else { | 388 } else { |
| 394 updateImage(true); | 389 updateImageAndClearBuffer(); |
|
f(malita)
2016/06/10 14:26:43
My understanding of the current impl is that image
hajimehoshi
2016/06/13 09:10:47
I think this doesn't happen with this CL.
| |
| 395 } | 390 } |
| 396 Resource::finish(loadFinishTime); | 391 Resource::finish(loadFinishTime); |
| 397 } | 392 } |
| 398 | 393 |
| 399 void ImageResource::error(const ResourceError& error) | 394 void ImageResource::error(const ResourceError& error) |
| 400 { | 395 { |
| 401 if (m_multipartParser) | 396 if (m_multipartParser) |
| 402 m_multipartParser->cancel(); | 397 m_multipartParser->cancel(); |
| 403 clear(); | 398 clear(); |
| 404 Resource::error(error); | 399 Resource::error(error); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 m_image->setAnimationPolicy(newPolicy); | 488 m_image->setAnimationPolicy(newPolicy); |
| 494 } | 489 } |
| 495 } | 490 } |
| 496 | 491 |
| 497 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher) | 492 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher) |
| 498 { | 493 { |
| 499 if (!m_response.httpHeaderField("chrome-proxy").contains("q=low")) | 494 if (!m_response.httpHeaderField("chrome-proxy").contains("q=low")) |
| 500 return; | 495 return; |
| 501 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache); | 496 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache); |
| 502 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff); | 497 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff); |
| 503 if (isLoading()) | 498 if (isLoading()) { |
| 504 m_loader->cancel(); | 499 m_loader->cancel(); |
| 505 else | 500 } |
| 506 updateImageAndClearBuffer(); | |
| 507 setStatus(NotStarted); | 501 setStatus(NotStarted); |
| 508 fetcher->startLoad(this); | 502 fetcher->startLoad(this); |
| 509 } | 503 } |
| 510 | 504 |
| 511 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) | 505 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) |
| 512 { | 506 { |
| 513 if (!image || image != m_image) | 507 if (!image || image != m_image) |
| 514 return; | 508 return; |
| 515 notifyObservers(&rect); | 509 notifyObservers(&rect); |
| 516 } | 510 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 if (response().wasFetchedViaServiceWorker()) | 543 if (response().wasFetchedViaServiceWorker()) |
| 550 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; | 544 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; |
| 551 if (!getImage()->currentFrameHasSingleSecurityOrigin()) | 545 if (!getImage()->currentFrameHasSingleSecurityOrigin()) |
| 552 return false; | 546 return false; |
| 553 if (passesAccessControlCheck(securityOrigin)) | 547 if (passesAccessControlCheck(securityOrigin)) |
| 554 return true; | 548 return true; |
| 555 return !securityOrigin->taintsCanvas(response().url()); | 549 return !securityOrigin->taintsCanvas(response().url()); |
| 556 } | 550 } |
| 557 | 551 |
| 558 } // namespace blink | 552 } // namespace blink |
| OLD | NEW |