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

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

Issue 2199713002: Refactoring: Make member variables in Resource private (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 // Go ahead and tell our observers to try to draw if we have either 396 // Go ahead and tell our observers to try to draw if we have either
397 // received all the data or the size is known. Each chunk from the 397 // received all the data or the size is known. Each chunk from the
398 // network causes observers to repaint, which will force that chunk 398 // network causes observers to repaint, which will force that chunk
399 // to decode. 399 // to decode.
400 if (sizeAvailable == Image::SizeUnavailable && !allDataReceived) 400 if (sizeAvailable == Image::SizeUnavailable && !allDataReceived)
401 return; 401 return;
402 if (!m_image || m_image->isNull()) { 402 if (!m_image || m_image->isNull()) {
403 if (!errorOccurred()) 403 if (!errorOccurred())
404 setStatus(DecodeError); 404 setStatus(DecodeError);
405 if (!allDataReceived && m_loader) 405 if (!allDataReceived && loader())
406 m_loader->didFinishLoading(nullptr, monotonicallyIncreasingTime(), e ncodedSize()); 406 loader()->didFinishLoading(nullptr, monotonicallyIncreasingTime(), e ncodedSize());
407 clear(); 407 clear();
408 memoryCache()->remove(this); 408 memoryCache()->remove(this);
409 } 409 }
410 410
411 // It would be nice to only redraw the decoded band of the image, but with t he current design 411 // It would be nice to only redraw the decoded band of the image, but with t he current design
412 // (decoding delayed until painting) that seems hard. 412 // (decoding delayed until painting) that seems hard.
413 notifyObservers(); 413 notifyObservers();
414 } 414 }
415 415
416 void ImageResource::updateImageAndClearBuffer() 416 void ImageResource::updateImageAndClearBuffer()
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 531 }
532 532
533 if (m_image->animationPolicy() != newPolicy) { 533 if (m_image->animationPolicy() != newPolicy) {
534 m_image->resetAnimation(); 534 m_image->resetAnimation();
535 m_image->setAnimationPolicy(newPolicy); 535 m_image->setAnimationPolicy(newPolicy);
536 } 536 }
537 } 537 }
538 538
539 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher) 539 void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher)
540 { 540 {
541 if (m_resourceRequest.loFiState() != WebURLRequest::LoFiOn) 541 if (resourceRequest().loFiState() != WebURLRequest::LoFiOn)
542 return; 542 return;
543 if (isLoaded() && !response().httpHeaderField("chrome-proxy").contains("q=lo w")) 543 if (isLoaded() && !response().httpHeaderField("chrome-proxy").contains("q=lo w"))
544 return; 544 return;
545 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache); 545 setCachePolicyBypassingCache();
546 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff); 546 setLoFiStateOff();
547 if (isLoading()) 547 if (isLoading())
548 m_loader->cancel(); 548 loader()->cancel();
549 clear(); 549 clear();
550 notifyObservers(); 550 notifyObservers();
551 551
552 setStatus(NotStarted); 552 setStatus(NotStarted);
553 fetcher->startLoad(this); 553 fetcher->startLoad(this);
554 } 554 }
555 555
556 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) 556 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect )
557 { 557 {
558 if (!image || image != m_image) 558 if (!image || image != m_image)
(...skipping 12 matching lines...) Expand all
571 return; 571 return;
572 } 572 }
573 updateImageAndClearBuffer(); 573 updateImageAndClearBuffer();
574 574
575 if (m_multipartParsingState == MultipartParsingState::ParsingFirstPart) { 575 if (m_multipartParsingState == MultipartParsingState::ParsingFirstPart) {
576 m_multipartParsingState = MultipartParsingState::FinishedParsingFirstPar t; 576 m_multipartParsingState = MultipartParsingState::FinishedParsingFirstPar t;
577 // Notify finished when the first part ends. 577 // Notify finished when the first part ends.
578 if (!errorOccurred()) 578 if (!errorOccurred())
579 setStatus(Cached); 579 setStatus(Cached);
580 checkNotify(); 580 checkNotify();
581 if (m_loader) 581 if (loader())
582 m_loader->didFinishLoadingFirstPartInMultipart(); 582 loader()->didFinishLoadingFirstPartInMultipart();
583 } 583 }
584 } 584 }
585 585
586 void ImageResource::multipartDataReceived(const char* bytes, size_t size) 586 void ImageResource::multipartDataReceived(const char* bytes, size_t size)
587 { 587 {
588 ASSERT(m_multipartParser); 588 ASSERT(m_multipartParser);
589 Resource::appendData(bytes, size); 589 Resource::appendData(bytes, size);
590 } 590 }
591 591
592 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) 592 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin)
593 { 593 {
594 if (response().wasFetchedViaServiceWorker()) 594 if (response().wasFetchedViaServiceWorker())
595 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 595 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
596 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 596 if (!getImage()->currentFrameHasSingleSecurityOrigin())
597 return false; 597 return false;
598 if (passesAccessControlCheck(securityOrigin)) 598 if (passesAccessControlCheck(securityOrigin))
599 return true; 599 return true;
600 return !securityOrigin->taintsCanvas(response().url()); 600 return !securityOrigin->taintsCanvas(response().url());
601 } 601 }
602 602
603 } // namespace blink 603 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.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