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

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

Issue 1410313002: Revert of Revalidate using the same Resource, attempt #3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 { 290 {
291 if (m_image) 291 if (m_image)
292 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int rinsicRatio); 292 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int rinsicRatio);
293 } 293 }
294 294
295 void ImageResource::notifyObservers(const IntRect* changeRect) 295 void ImageResource::notifyObservers(const IntRect* changeRect)
296 { 296 {
297 ResourceClientWalker<ImageResourceClient> w(m_clients); 297 ResourceClientWalker<ImageResourceClient> w(m_clients);
298 while (ImageResourceClient* c = w.next()) 298 while (ImageResourceClient* c = w.next())
299 c->imageChanged(this, changeRect); 299 c->imageChanged(this, changeRect);
300
301 ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
302 while (ImageResourceClient* c = w2.next())
303 c->imageChanged(this, changeRect);
304 } 300 }
305 301
306 void ImageResource::clear() 302 void ImageResource::clear()
307 { 303 {
308 prune(); 304 prune();
309 clearImage(); 305 clearImage();
310 setEncodedSize(0); 306 setEncodedSize(0);
311 } 307 }
312 308
313 void ImageResource::setCustomAcceptHeader() 309 void ImageResource::setCustomAcceptHeader()
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 { 389 {
394 clear(); 390 clear();
395 Resource::error(status); 391 Resource::error(status);
396 notifyObservers(); 392 notifyObservers();
397 } 393 }
398 394
399 void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPt r<WebDataConsumerHandle> handle) 395 void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPt r<WebDataConsumerHandle> handle)
400 { 396 {
401 if (loadingMultipartContent() && m_data) 397 if (loadingMultipartContent() && m_data)
402 finishOnePart(); 398 finishOnePart();
403 Resource::responseReceived(response, handle);
404 if (RuntimeEnabledFeatures::clientHintsEnabled()) { 399 if (RuntimeEnabledFeatures::clientHintsEnabled()) {
405 m_devicePixelRatioHeaderValue = m_response.httpHeaderField("content-dpr" ).toFloat(&m_hasDevicePixelRatioHeaderValue); 400 m_devicePixelRatioHeaderValue = response.httpHeaderField("content-dpr"). toFloat(&m_hasDevicePixelRatioHeaderValue);
406 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue < = 0.0) { 401 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue < = 0.0) {
407 m_devicePixelRatioHeaderValue = 1.0; 402 m_devicePixelRatioHeaderValue = 1.0;
408 m_hasDevicePixelRatioHeaderValue = false; 403 m_hasDevicePixelRatioHeaderValue = false;
409 } 404 }
410 405
411 } 406 }
407 Resource::responseReceived(response, handle);
412 } 408 }
413 409
414 void ImageResource::decodedSizeChanged(const blink::Image* image, int delta) 410 void ImageResource::decodedSizeChanged(const blink::Image* image, int delta)
415 { 411 {
416 if (!image || image != m_image) 412 if (!image || image != m_image)
417 return; 413 return;
418 414
419 setDecodedSize(decodedSize() + delta); 415 setDecodedSize(decodedSize() + delta);
420 } 416 }
421 417
(...skipping 12 matching lines...) Expand all
434 { 430 {
435 if (!image || image != m_image) 431 if (!image || image != m_image)
436 return false; 432 return false;
437 433
438 ResourceClientWalker<ImageResourceClient> w(m_clients); 434 ResourceClientWalker<ImageResourceClient> w(m_clients);
439 while (ImageResourceClient* c = w.next()) { 435 while (ImageResourceClient* c = w.next()) {
440 if (c->willRenderImage(this)) 436 if (c->willRenderImage(this))
441 return false; 437 return false;
442 } 438 }
443 439
444 ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
445 while (ImageResourceClient* c = w2.next()) {
446 if (c->willRenderImage(this))
447 return false;
448 }
449
450 return true; 440 return true;
451 } 441 }
452 442
453 void ImageResource::animationAdvanced(const blink::Image* image) 443 void ImageResource::animationAdvanced(const blink::Image* image)
454 { 444 {
455 if (!image || image != m_image) 445 if (!image || image != m_image)
456 return; 446 return;
457 notifyObservers(); 447 notifyObservers();
458 } 448 }
459 449
460 void ImageResource::updateImageAnimationPolicy() 450 void ImageResource::updateImageAnimationPolicy()
461 { 451 {
462 if (!m_image) 452 if (!m_image)
463 return; 453 return;
464 454
465 ImageAnimationPolicy newPolicy = ImageAnimationPolicyAllowed; 455 ImageAnimationPolicy newPolicy = ImageAnimationPolicyAllowed;
466 ResourceClientWalker<ImageResourceClient> w(m_clients); 456 ResourceClientWalker<ImageResourceClient> w(m_clients);
467 while (ImageResourceClient* c = w.next()) { 457 while (ImageResourceClient* c = w.next()) {
468 if (c->getImageAnimationPolicy(this, newPolicy)) 458 if (c->getImageAnimationPolicy(this, newPolicy))
469 break; 459 break;
470 } 460 }
471
472 ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
473 while (ImageResourceClient* c = w2.next()) {
474 if (c->getImageAnimationPolicy(this, newPolicy))
475 break;
476 }
477 461
478 if (m_image->animationPolicy() != newPolicy) { 462 if (m_image->animationPolicy() != newPolicy) {
479 m_image->resetAnimation(); 463 m_image->resetAnimation();
480 m_image->setAnimationPolicy(newPolicy); 464 m_image->setAnimationPolicy(newPolicy);
481 } 465 }
482 } 466 }
483 467
484 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) 468 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect )
485 { 469 {
486 if (!image || image != m_image) 470 if (!image || image != m_image)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 533
550 return imageForContainer.get(); 534 return imageForContainer.get();
551 } 535 }
552 536
553 bool ImageResource::loadingMultipartContent() const 537 bool ImageResource::loadingMultipartContent() const
554 { 538 {
555 return m_loader && m_loader->loadingMultipartContent(); 539 return m_loader && m_loader->loadingMultipartContent();
556 } 540 }
557 541
558 } // namespace blink 542 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FontResource.cpp ('k') | third_party/WebKit/Source/core/fetch/RawResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698