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

Side by Side Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 2746343002: Phase III Step 1: Make ImageResourceContent manage its own ResourceStatus (Closed)
Patch Set: Reflect comments Created 3 years, 7 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 // Prevent the creation of a ResourceLoader (and therefore a network request) 395 // Prevent the creation of a ResourceLoader (and therefore a network request)
396 // for ImageDocument loads. In this case, the image contents have already been 396 // for ImageDocument loads. In this case, the image contents have already been
397 // requested as a main resource and ImageDocumentParser will take care of 397 // requested as a main resource and ImageDocumentParser will take care of
398 // funneling the main resource bytes into m_image, so just create an 398 // funneling the main resource bytes into m_image, so just create an
399 // ImageResource to be populated later. 399 // ImageResource to be populated later.
400 if (loading_image_document_ && update_behavior != kUpdateForcedReload) { 400 if (loading_image_document_ && update_behavior != kUpdateForcedReload) {
401 ImageResource* image_resource = ImageResource::Create( 401 ImageResource* image_resource = ImageResource::Create(
402 ResourceRequest(ImageSourceToKURL(element_->ImageSourceURL()))); 402 ResourceRequest(ImageSourceToKURL(element_->ImageSourceURL())));
403 image_resource->SetStatus(ResourceStatus::kPending); 403 image_resource->SetStatus(ResourceStatus::kPending);
404 image_resource->NotifyStartLoad();
404 image_resource_for_image_document_ = image_resource; 405 image_resource_for_image_document_ = image_resource;
405 SetImage(image_resource->GetContent()); 406 SetImage(image_resource->GetContent());
406 return; 407 return;
407 } 408 }
408 409
409 // If we have a pending task, we have to clear it -- either we're now loading 410 // If we have a pending task, we have to clear it -- either we're now loading
410 // immediately, or we need to reset the task's state. 411 // immediately, or we need to reset the task's state.
411 if (pending_task_) { 412 if (pending_task_) {
412 pending_task_->ClearLoader(); 413 pending_task_->ClearLoader();
413 pending_task_.reset(); 414 pending_task_.reset();
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 636 }
636 637
637 void ImageLoader::ElementDidMoveToNewDocument() { 638 void ImageLoader::ElementDidMoveToNewDocument() {
638 if (load_delay_counter_) 639 if (load_delay_counter_)
639 load_delay_counter_->DocumentChanged(element_->GetDocument()); 640 load_delay_counter_->DocumentChanged(element_->GetDocument());
640 ClearFailedLoadURL(); 641 ClearFailedLoadURL();
641 SetImage(0); 642 SetImage(0);
642 } 643 }
643 644
644 } // namespace blink 645 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698