| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 bool hasDevicePixelRatioHeaderValue() const override { | 70 bool hasDevicePixelRatioHeaderValue() const override { |
| 71 return m_resource->m_hasDevicePixelRatioHeaderValue; | 71 return m_resource->m_hasDevicePixelRatioHeaderValue; |
| 72 } | 72 } |
| 73 float devicePixelRatioHeaderValue() const override { | 73 float devicePixelRatioHeaderValue() const override { |
| 74 return m_resource->m_devicePixelRatioHeaderValue; | 74 return m_resource->m_devicePixelRatioHeaderValue; |
| 75 } | 75 } |
| 76 const ResourceResponse& response() const override { | 76 const ResourceResponse& response() const override { |
| 77 return m_resource->response(); | 77 return m_resource->response(); |
| 78 } | 78 } |
| 79 Resource::Status getStatus() const override { | 79 ResourceStatus getStatus() const override { return m_resource->getStatus(); } |
| 80 return m_resource->getStatus(); | |
| 81 } | |
| 82 bool isPlaceholder() const override { return m_resource->isPlaceholder(); } | 80 bool isPlaceholder() const override { return m_resource->isPlaceholder(); } |
| 83 bool isCacheValidator() const override { | 81 bool isCacheValidator() const override { |
| 84 return m_resource->isCacheValidator(); | 82 return m_resource->isCacheValidator(); |
| 85 } | 83 } |
| 86 bool schedulingReloadOrShouldReloadBrokenPlaceholder() const override { | 84 bool schedulingReloadOrShouldReloadBrokenPlaceholder() const override { |
| 87 return m_resource->m_isSchedulingReload || | 85 return m_resource->m_isSchedulingReload || |
| 88 m_resource->shouldReloadBrokenPlaceholder(); | 86 m_resource->shouldReloadBrokenPlaceholder(); |
| 89 } | 87 } |
| 90 bool isAccessAllowed( | 88 bool isAccessAllowed( |
| 91 SecurityOrigin* securityOrigin, | 89 SecurityOrigin* securityOrigin, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 bool ImageResource::willPaintBrokenImage() const { | 317 bool ImageResource::willPaintBrokenImage() const { |
| 320 return errorOccurred(); | 318 return errorOccurred(); |
| 321 } | 319 } |
| 322 | 320 |
| 323 void ImageResource::decodeError(bool allDataReceived) { | 321 void ImageResource::decodeError(bool allDataReceived) { |
| 324 size_t size = encodedSize(); | 322 size_t size = encodedSize(); |
| 325 | 323 |
| 326 clearData(); | 324 clearData(); |
| 327 setEncodedSize(0); | 325 setEncodedSize(0); |
| 328 if (!errorOccurred()) | 326 if (!errorOccurred()) |
| 329 setStatus(DecodeError); | 327 setStatus(ResourceStatus::DecodeError); |
| 330 | 328 |
| 331 if (!allDataReceived && loader()) { | 329 if (!allDataReceived && loader()) { |
| 332 // TODO(hiroshige): Do not call didFinishLoading() directly. | 330 // TODO(hiroshige): Do not call didFinishLoading() directly. |
| 333 loader()->didFinishLoading(monotonicallyIncreasingTime(), size, size); | 331 loader()->didFinishLoading(monotonicallyIncreasingTime(), size, size); |
| 334 } | 332 } |
| 335 | 333 |
| 336 memoryCache()->remove(this); | 334 memoryCache()->remove(this); |
| 337 } | 335 } |
| 338 | 336 |
| 339 void ImageResource::updateImageAndClearBuffer() { | 337 void ImageResource::updateImageAndClearBuffer() { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // Canceling the loader causes error() to be called, which in turn calls | 433 // Canceling the loader causes error() to be called, which in turn calls |
| 436 // clear() and notifyObservers(), so there's no need to call these again | 434 // clear() and notifyObservers(), so there's no need to call these again |
| 437 // here. | 435 // here. |
| 438 } else { | 436 } else { |
| 439 clearData(); | 437 clearData(); |
| 440 setEncodedSize(0); | 438 setEncodedSize(0); |
| 441 updateImage(nullptr, ImageResourceContent::ClearImageAndNotifyObservers, | 439 updateImage(nullptr, ImageResourceContent::ClearImageAndNotifyObservers, |
| 442 false); | 440 false); |
| 443 } | 441 } |
| 444 | 442 |
| 445 setStatus(NotStarted); | 443 setStatus(ResourceStatus::NotStarted); |
| 446 | 444 |
| 447 DCHECK(m_isSchedulingReload); | 445 DCHECK(m_isSchedulingReload); |
| 448 m_isSchedulingReload = false; | 446 m_isSchedulingReload = false; |
| 449 | 447 |
| 450 fetcher->startLoad(this); | 448 fetcher->startLoad(this); |
| 451 } | 449 } |
| 452 | 450 |
| 453 void ImageResource::onePartInMultipartReceived( | 451 void ImageResource::onePartInMultipartReceived( |
| 454 const ResourceResponse& response) { | 452 const ResourceResponse& response) { |
| 455 DCHECK(m_multipartParser); | 453 DCHECK(m_multipartParser); |
| 456 | 454 |
| 457 setResponse(response); | 455 setResponse(response); |
| 458 if (m_multipartParsingState == MultipartParsingState::WaitingForFirstPart) { | 456 if (m_multipartParsingState == MultipartParsingState::WaitingForFirstPart) { |
| 459 // We have nothing to do because we don't have any data. | 457 // We have nothing to do because we don't have any data. |
| 460 m_multipartParsingState = MultipartParsingState::ParsingFirstPart; | 458 m_multipartParsingState = MultipartParsingState::ParsingFirstPart; |
| 461 return; | 459 return; |
| 462 } | 460 } |
| 463 updateImageAndClearBuffer(); | 461 updateImageAndClearBuffer(); |
| 464 | 462 |
| 465 if (m_multipartParsingState == MultipartParsingState::ParsingFirstPart) { | 463 if (m_multipartParsingState == MultipartParsingState::ParsingFirstPart) { |
| 466 m_multipartParsingState = MultipartParsingState::FinishedParsingFirstPart; | 464 m_multipartParsingState = MultipartParsingState::FinishedParsingFirstPart; |
| 467 // Notify finished when the first part ends. | 465 // Notify finished when the first part ends. |
| 468 if (!errorOccurred()) | 466 if (!errorOccurred()) |
| 469 setStatus(Cached); | 467 setStatus(ResourceStatus::Cached); |
| 470 // We notify clients and observers of finish in checkNotify() and | 468 // We notify clients and observers of finish in checkNotify() and |
| 471 // updateImageAndClearBuffer(), respectively, and they will not be | 469 // updateImageAndClearBuffer(), respectively, and they will not be |
| 472 // notified again in Resource::finish()/error(). | 470 // notified again in Resource::finish()/error(). |
| 473 checkNotify(); | 471 checkNotify(); |
| 474 if (loader()) | 472 if (loader()) |
| 475 loader()->didFinishLoadingFirstPartInMultipart(); | 473 loader()->didFinishLoadingFirstPartInMultipart(); |
| 476 } | 474 } |
| 477 } | 475 } |
| 478 | 476 |
| 479 void ImageResource::multipartDataReceived(const char* bytes, size_t size) { | 477 void ImageResource::multipartDataReceived(const char* bytes, size_t size) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 509 |
| 512 void ImageResource::updateImage( | 510 void ImageResource::updateImage( |
| 513 PassRefPtr<SharedBuffer> sharedBuffer, | 511 PassRefPtr<SharedBuffer> sharedBuffer, |
| 514 ImageResourceContent::UpdateImageOption updateImageOption, | 512 ImageResourceContent::UpdateImageOption updateImageOption, |
| 515 bool allDataReceived) { | 513 bool allDataReceived) { |
| 516 getContent()->updateImage(std::move(sharedBuffer), updateImageOption, | 514 getContent()->updateImage(std::move(sharedBuffer), updateImageOption, |
| 517 allDataReceived); | 515 allDataReceived); |
| 518 } | 516 } |
| 519 | 517 |
| 520 } // namespace blink | 518 } // namespace blink |
| OLD | NEW |