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

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

Issue 2810423003: Schedule bitmap animation timers on the compositor task runner. (Closed)
Patch Set: fix up comment about a method changed by blink reformat 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 13 matching lines...) Expand all
24 24
25 #include <memory> 25 #include <memory>
26 #include "bindings/core/v8/Microtask.h" 26 #include "bindings/core/v8/Microtask.h"
27 #include "bindings/core/v8/ScriptController.h" 27 #include "bindings/core/v8/ScriptController.h"
28 #include "bindings/core/v8/ScriptState.h" 28 #include "bindings/core/v8/ScriptState.h"
29 #include "bindings/core/v8/V8BindingForCore.h" 29 #include "bindings/core/v8/V8BindingForCore.h"
30 #include "bindings/core/v8/V8PerIsolateData.h" 30 #include "bindings/core/v8/V8PerIsolateData.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/Element.h" 32 #include "core/dom/Element.h"
33 #include "core/dom/IncrementLoadEventDelayCount.h" 33 #include "core/dom/IncrementLoadEventDelayCount.h"
34 #include "core/dom/TaskRunnerHelper.h"
34 #include "core/events/Event.h" 35 #include "core/events/Event.h"
35 #include "core/events/EventSender.h" 36 #include "core/events/EventSender.h"
36 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
37 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
38 #include "core/frame/UseCounter.h" 39 #include "core/frame/UseCounter.h"
39 #include "core/html/CrossOriginAttribute.h" 40 #include "core/html/CrossOriginAttribute.h"
40 #include "core/html/HTMLImageElement.h" 41 #include "core/html/HTMLImageElement.h"
41 #include "core/html/parser/HTMLParserIdioms.h" 42 #include "core/html/parser/HTMLParserIdioms.h"
42 #include "core/layout/LayoutImage.h" 43 #include "core/layout/LayoutImage.h"
43 #include "core/layout/LayoutVideo.h" 44 #include "core/layout/LayoutVideo.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 FetchParameters params(resource_request, GetElement()->localName(), 315 FetchParameters params(resource_request, GetElement()->localName(),
315 resource_loader_options); 316 resource_loader_options);
316 ConfigureRequest(params, bypass_behavior, *element_, 317 ConfigureRequest(params, bypass_behavior, *element_,
317 document.GetClientHintsPreferences()); 318 document.GetClientHintsPreferences());
318 319
319 if (update_behavior != kUpdateForcedReload && document.GetSettings() && 320 if (update_behavior != kUpdateForcedReload && document.GetSettings() &&
320 document.GetSettings()->GetFetchImagePlaceholders()) { 321 document.GetSettings()->GetFetchImagePlaceholders()) {
321 params.SetAllowImagePlaceholder(); 322 params.SetAllowImagePlaceholder();
322 } 323 }
323 324
324 new_image = ImageResourceContent::Fetch(params, document.Fetcher()); 325 RefPtr<WebTaskRunner> task_runner = TaskRunnerHelper::Get(
326 TaskType::kAnimationTimer, &element_->GetDocument());
327
328 new_image =
329 ImageResourceContent::Fetch(task_runner, params, document.Fetcher());
325 330
326 if (!new_image && !PageIsBeingDismissed(&document)) { 331 if (!new_image && !PageIsBeingDismissed(&document)) {
327 CrossSiteOrCSPViolationOccurred(image_source_url); 332 CrossSiteOrCSPViolationOccurred(image_source_url);
328 DispatchErrorEvent(); 333 DispatchErrorEvent();
329 } else { 334 } else {
330 ClearFailedLoadURL(); 335 ClearFailedLoadURL();
331 } 336 }
332 } else { 337 } else {
333 if (!image_source_url.IsNull()) { 338 if (!image_source_url.IsNull()) {
334 // Fire an error event if the url string is not empty, but the KURL is. 339 // Fire an error event if the url string is not empty, but the KURL is.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 398
394 if (!failed_load_url_.IsEmpty() && image_source_url == failed_load_url_) 399 if (!failed_load_url_.IsEmpty() && image_source_url == failed_load_url_)
395 return; 400 return;
396 401
397 // Prevent the creation of a ResourceLoader (and therefore a network request) 402 // Prevent the creation of a ResourceLoader (and therefore a network request)
398 // for ImageDocument loads. In this case, the image contents have already been 403 // for ImageDocument loads. In this case, the image contents have already been
399 // requested as a main resource and ImageDocumentParser will take care of 404 // requested as a main resource and ImageDocumentParser will take care of
400 // funneling the main resource bytes into m_image, so just create an 405 // funneling the main resource bytes into m_image, so just create an
401 // ImageResource to be populated later. 406 // ImageResource to be populated later.
402 if (loading_image_document_ && update_behavior != kUpdateForcedReload) { 407 if (loading_image_document_ && update_behavior != kUpdateForcedReload) {
408 RefPtr<WebTaskRunner> task_runner = TaskRunnerHelper::Get(
409 TaskType::kAnimationTimer, &element_->GetDocument());
403 ImageResource* image_resource = ImageResource::Create( 410 ImageResource* image_resource = ImageResource::Create(
411 task_runner,
404 ResourceRequest(ImageSourceToKURL(element_->ImageSourceURL()))); 412 ResourceRequest(ImageSourceToKURL(element_->ImageSourceURL())));
405 image_resource->SetStatus(ResourceStatus::kPending); 413 image_resource->SetStatus(ResourceStatus::kPending);
406 image_resource_for_image_document_ = image_resource; 414 image_resource_for_image_document_ = image_resource;
407 SetImage(image_resource->GetContent()); 415 SetImage(image_resource->GetContent());
408 return; 416 return;
409 } 417 }
410 418
411 // If we have a pending task, we have to clear it -- either we're now loading 419 // If we have a pending task, we have to clear it -- either we're now loading
412 // immediately, or we need to reset the task's state. 420 // immediately, or we need to reset the task's state.
413 if (pending_task_) { 421 if (pending_task_) {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 645 }
638 646
639 void ImageLoader::ElementDidMoveToNewDocument() { 647 void ImageLoader::ElementDidMoveToNewDocument() {
640 if (load_delay_counter_) 648 if (load_delay_counter_)
641 load_delay_counter_->DocumentChanged(element_->GetDocument()); 649 load_delay_counter_->DocumentChanged(element_->GetDocument());
642 ClearFailedLoadURL(); 650 ClearFailedLoadURL();
643 SetImage(0); 651 SetImage(0);
644 } 652 }
645 653
646 } // namespace blink 654 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698