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

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

Issue 1398523004: 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);
300 } 304 }
301 305
302 void ImageResource::clear() 306 void ImageResource::clear()
303 { 307 {
304 prune(); 308 prune();
305 clearImage(); 309 clearImage();
306 setEncodedSize(0); 310 setEncodedSize(0);
307 } 311 }
308 312
309 void ImageResource::setCustomAcceptHeader() 313 void ImageResource::setCustomAcceptHeader()
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 { 393 {
390 clear(); 394 clear();
391 Resource::error(status); 395 Resource::error(status);
392 notifyObservers(); 396 notifyObservers();
393 } 397 }
394 398
395 void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPt r<WebDataConsumerHandle> handle) 399 void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPt r<WebDataConsumerHandle> handle)
396 { 400 {
397 if (loadingMultipartContent() && m_data) 401 if (loadingMultipartContent() && m_data)
398 finishOnePart(); 402 finishOnePart();
403 Resource::responseReceived(response, handle);
399 if (RuntimeEnabledFeatures::clientHintsEnabled()) { 404 if (RuntimeEnabledFeatures::clientHintsEnabled()) {
400 m_devicePixelRatioHeaderValue = response.httpHeaderField("content-dpr"). toFloat(&m_hasDevicePixelRatioHeaderValue); 405 m_devicePixelRatioHeaderValue = m_response.httpHeaderField("content-dpr" ).toFloat(&m_hasDevicePixelRatioHeaderValue);
401 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue < = 0.0) { 406 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue < = 0.0) {
402 m_devicePixelRatioHeaderValue = 1.0; 407 m_devicePixelRatioHeaderValue = 1.0;
403 m_hasDevicePixelRatioHeaderValue = false; 408 m_hasDevicePixelRatioHeaderValue = false;
404 } 409 }
405 410
406 } 411 }
407 Resource::responseReceived(response, handle);
408 } 412 }
409 413
410 void ImageResource::decodedSizeChanged(const blink::Image* image, int delta) 414 void ImageResource::decodedSizeChanged(const blink::Image* image, int delta)
411 { 415 {
412 if (!image || image != m_image) 416 if (!image || image != m_image)
413 return; 417 return;
414 418
415 setDecodedSize(decodedSize() + delta); 419 setDecodedSize(decodedSize() + delta);
416 } 420 }
417 421
(...skipping 12 matching lines...) Expand all
430 { 434 {
431 if (!image || image != m_image) 435 if (!image || image != m_image)
432 return false; 436 return false;
433 437
434 ResourceClientWalker<ImageResourceClient> w(m_clients); 438 ResourceClientWalker<ImageResourceClient> w(m_clients);
435 while (ImageResourceClient* c = w.next()) { 439 while (ImageResourceClient* c = w.next()) {
436 if (c->willRenderImage(this)) 440 if (c->willRenderImage(this))
437 return false; 441 return false;
438 } 442 }
439 443
444 ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
445 while (ImageResourceClient* c = w2.next()) {
446 if (c->willRenderImage(this))
447 return false;
448 }
449
440 return true; 450 return true;
441 } 451 }
442 452
443 void ImageResource::animationAdvanced(const blink::Image* image) 453 void ImageResource::animationAdvanced(const blink::Image* image)
444 { 454 {
445 if (!image || image != m_image) 455 if (!image || image != m_image)
446 return; 456 return;
447 notifyObservers(); 457 notifyObservers();
448 } 458 }
449 459
450 void ImageResource::updateImageAnimationPolicy() 460 void ImageResource::updateImageAnimationPolicy()
451 { 461 {
452 if (!m_image) 462 if (!m_image)
453 return; 463 return;
454 464
455 ImageAnimationPolicy newPolicy = ImageAnimationPolicyAllowed; 465 ImageAnimationPolicy newPolicy = ImageAnimationPolicyAllowed;
456 ResourceClientWalker<ImageResourceClient> w(m_clients); 466 ResourceClientWalker<ImageResourceClient> w(m_clients);
457 while (ImageResourceClient* c = w.next()) { 467 while (ImageResourceClient* c = w.next()) {
458 if (c->getImageAnimationPolicy(this, newPolicy)) 468 if (c->getImageAnimationPolicy(this, newPolicy))
459 break; 469 break;
460 } 470 }
461 471
472 ResourceClientWalker<ImageResourceClient> w2(m_finishedClients);
473 while (ImageResourceClient* c = w2.next()) {
474 if (c->getImageAnimationPolicy(this, newPolicy))
475 break;
476 }
477
462 if (m_image->animationPolicy() != newPolicy) { 478 if (m_image->animationPolicy() != newPolicy) {
463 m_image->resetAnimation(); 479 m_image->resetAnimation();
464 m_image->setAnimationPolicy(newPolicy); 480 m_image->setAnimationPolicy(newPolicy);
465 } 481 }
466 } 482 }
467 483
468 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) 484 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect )
469 { 485 {
470 if (!image || image != m_image) 486 if (!image || image != m_image)
471 return; 487 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 549
534 return imageForContainer.get(); 550 return imageForContainer.get();
535 } 551 }
536 552
537 bool ImageResource::loadingMultipartContent() const 553 bool ImageResource::loadingMultipartContent() const
538 { 554 {
539 return m_loader && m_loader->loadingMultipartContent(); 555 return m_loader && m_loader->loadingMultipartContent();
540 } 556 }
541 557
542 } // namespace blink 558 } // 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