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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp

Issue 2275493002: Remove EventSender from HTMLLinkElement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use TaskRunnerHelper Created 4 years, 3 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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
7 * Copyright (C) 2011 Google Inc. All rights reserved. 7 * Copyright (C) 2011 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 15 matching lines...) Expand all
26 26
27 #include "bindings/core/v8/ScriptEventListener.h" 27 #include "bindings/core/v8/ScriptEventListener.h"
28 #include "core/HTMLNames.h" 28 #include "core/HTMLNames.h"
29 #include "core/css/MediaList.h" 29 #include "core/css/MediaList.h"
30 #include "core/css/MediaQueryEvaluator.h" 30 #include "core/css/MediaQueryEvaluator.h"
31 #include "core/css/StyleSheetContents.h" 31 #include "core/css/StyleSheetContents.h"
32 #include "core/css/resolver/StyleResolver.h" 32 #include "core/css/resolver/StyleResolver.h"
33 #include "core/dom/Attribute.h" 33 #include "core/dom/Attribute.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/StyleEngine.h" 35 #include "core/dom/StyleEngine.h"
36 #include "core/dom/TaskRunnerHelper.h"
36 #include "core/events/Event.h" 37 #include "core/events/Event.h"
37 #include "core/events/EventSender.h"
38 #include "core/fetch/CSSStyleSheetResource.h" 38 #include "core/fetch/CSSStyleSheetResource.h"
39 #include "core/fetch/FetchRequest.h" 39 #include "core/fetch/FetchRequest.h"
40 #include "core/fetch/ResourceFetcher.h" 40 #include "core/fetch/ResourceFetcher.h"
41 #include "core/frame/FrameView.h" 41 #include "core/frame/FrameView.h"
42 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
43 #include "core/frame/SubresourceIntegrity.h" 43 #include "core/frame/SubresourceIntegrity.h"
44 #include "core/frame/UseCounter.h" 44 #include "core/frame/UseCounter.h"
45 #include "core/frame/csp/ContentSecurityPolicy.h" 45 #include "core/frame/csp/ContentSecurityPolicy.h"
46 #include "core/html/CrossOriginAttribute.h" 46 #include "core/html/CrossOriginAttribute.h"
47 #include "core/html/LinkManifest.h" 47 #include "core/html/LinkManifest.h"
48 #include "core/html/imports/LinkImport.h" 48 #include "core/html/imports/LinkImport.h"
49 #include "core/inspector/ConsoleMessage.h" 49 #include "core/inspector/ConsoleMessage.h"
50 #include "core/loader/FrameLoader.h" 50 #include "core/loader/FrameLoader.h"
51 #include "core/loader/FrameLoaderClient.h" 51 #include "core/loader/FrameLoaderClient.h"
52 #include "core/loader/NetworkHintsInterface.h" 52 #include "core/loader/NetworkHintsInterface.h"
53 #include "core/origin_trials/OriginTrials.h" 53 #include "core/origin_trials/OriginTrials.h"
54 #include "core/style/StyleInheritedData.h" 54 #include "core/style/StyleInheritedData.h"
55 #include "platform/ContentType.h" 55 #include "platform/ContentType.h"
56 #include "platform/Histogram.h" 56 #include "platform/Histogram.h"
57 #include "platform/MIMETypeRegistry.h" 57 #include "platform/MIMETypeRegistry.h"
58 #include "platform/RuntimeEnabledFeatures.h" 58 #include "platform/RuntimeEnabledFeatures.h"
59 #include "public/platform/WebIconSizesParser.h" 59 #include "public/platform/WebIconSizesParser.h"
60 #include "public/platform/WebSize.h" 60 #include "public/platform/WebSize.h"
61 #include "wtf/StdLibExtras.h" 61 #include "wtf/StdLibExtras.h"
62 62
63 namespace blink { 63 namespace blink {
64 64
65 using namespace HTMLNames; 65 using namespace HTMLNames;
66 66
67 static LinkEventSender& linkLoadEventSender()
68 {
69 DEFINE_STATIC_LOCAL(LinkEventSender, sharedLoadEventSender, (LinkEventSender ::create(EventTypeNames::load)));
70 return sharedLoadEventSender;
71 }
72
73 static bool styleSheetTypeIsSupported(const String& type) 67 static bool styleSheetTypeIsSupported(const String& type)
74 { 68 {
75 String trimmedType = ContentType(type).type(); 69 String trimmedType = ContentType(type).type();
76 return trimmedType.isEmpty() || MIMETypeRegistry::isSupportedStyleSheetMIMET ype(trimmedType); 70 return trimmedType.isEmpty() || MIMETypeRegistry::isSupportedStyleSheetMIMET ype(trimmedType);
77 } 71 }
78 72
79 inline HTMLLinkElement::HTMLLinkElement(Document& document, bool createdByParser ) 73 inline HTMLLinkElement::HTMLLinkElement(Document& document, bool createdByParser )
80 : HTMLElement(linkTag, document) 74 : HTMLElement(linkTag, document)
81 , m_linkLoader(LinkLoader::create(this)) 75 , m_linkLoader(LinkLoader::create(this))
82 , m_sizes(DOMTokenList::create(this)) 76 , m_sizes(DOMTokenList::create(this))
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 DCHECK(linkStyle()); 295 DCHECK(linkStyle());
302 return linkStyle()->sheetLoaded(); 296 return linkStyle()->sheetLoaded();
303 } 297 }
304 298
305 void HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources(LoadedSheetErr orStatus errorStatus) 299 void HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources(LoadedSheetErr orStatus errorStatus)
306 { 300 {
307 DCHECK(linkStyle()); 301 DCHECK(linkStyle());
308 linkStyle()->notifyLoadedSheetAndAllCriticalSubresources(errorStatus); 302 linkStyle()->notifyLoadedSheetAndAllCriticalSubresources(errorStatus);
309 } 303 }
310 304
311 void HTMLLinkElement::dispatchPendingLoadEvents() 305 void HTMLLinkElement::dispatchPendingEvent(std::unique_ptr<IncrementLoadEventDel ayCount>)
312 { 306 {
313 linkLoadEventSender().dispatchPendingEvents();
314 }
315
316 void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
317 {
318 DCHECK_EQ(eventSender, &linkLoadEventSender());
319 DCHECK(m_link); 307 DCHECK(m_link);
320 if (m_link->hasLoaded()) 308 if (m_link->hasLoaded())
321 linkLoaded(); 309 linkLoaded();
322 else 310 else
323 linkLoadingErrored(); 311 linkLoadingErrored();
324 } 312 }
325 313
326 void HTMLLinkElement::scheduleEvent() 314 void HTMLLinkElement::scheduleEvent()
327 { 315 {
328 linkLoadEventSender().dispatchEventSoon(this); 316 TaskRunnerHelper::getLoadingTaskRunner(&document())->postTask(BLINK_FROM_HER E, WTF::bind(&HTMLLinkElement::dispatchPendingEvent, wrapPersistent(this), passe d(IncrementLoadEventDelayCount::create(document()))));
haraken 2016/09/01 17:48:37 TaskRunnerHelper::getXXXTaskRunner has been deprec
hiroshige 2016/09/02 10:11:26 Thanks! Modified.
329 } 317 }
330 318
331 void HTMLLinkElement::startLoadingDynamicSheet() 319 void HTMLLinkElement::startLoadingDynamicSheet()
332 { 320 {
333 DCHECK(linkStyle()); 321 DCHECK(linkStyle());
334 linkStyle()->startLoadingDynamicSheet(); 322 linkStyle()->startLoadingDynamicSheet();
335 } 323 }
336 324
337 bool HTMLLinkElement::isURLAttribute(const Attribute& attribute) const 325 bool HTMLLinkElement::isURLAttribute(const Attribute& attribute) const
338 { 326 {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 714 }
727 715
728 DEFINE_TRACE(LinkStyle) 716 DEFINE_TRACE(LinkStyle)
729 { 717 {
730 visitor->trace(m_sheet); 718 visitor->trace(m_sheet);
731 LinkResource::trace(visitor); 719 LinkResource::trace(visitor);
732 ResourceOwner<StyleSheetResource>::trace(visitor); 720 ResourceOwner<StyleSheetResource>::trace(visitor);
733 } 721 }
734 722
735 } // namespace blink 723 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLLinkElement.h ('k') | third_party/WebKit/Source/web/tests/sim/SimTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698