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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 case Resource::ImportResource: 100 case Resource::ImportResource:
101 return new RawResource(request, type); 101 return new RawResource(request, type);
102 } 102 }
103 103
104 ASSERT_NOT_REACHED(); 104 ASSERT_NOT_REACHED();
105 return 0; 105 return 0;
106 } 106 }
107 107
108 static ResourceLoadPriority loadPriority(Resource::Type type, const FetchRequest & request) 108 static ResourceLoadPriority loadPriority(Resource::Type type, const FetchRequest & request)
109 { 109 {
110 if (request.priority() != ResourceLoadPriorityUnresolved) 110 if (request.resourceRequest().priority() != ResourceLoadPriorityUnresolved)
111 return request.priority(); 111 return request.resourceRequest().priority();
112 112
113 switch (type) { 113 switch (type) {
114 case Resource::MainResource: 114 case Resource::MainResource:
115 return ResourceLoadPriorityVeryHigh; 115 return ResourceLoadPriorityVeryHigh;
116 case Resource::CSSStyleSheet: 116 case Resource::CSSStyleSheet:
117 return ResourceLoadPriorityHigh; 117 return ResourceLoadPriorityHigh;
118 case Resource::Raw: 118 case Resource::Raw:
119 return request.options().synchronousPolicy == RequestSynchronously ? Res ourceLoadPriorityVeryHigh : ResourceLoadPriorityMedium; 119 return request.options().synchronousPolicy == RequestSynchronously ? Res ourceLoadPriorityVeryHigh : ResourceLoadPriorityMedium;
120 case Resource::Script: 120 case Resource::Script:
121 case Resource::Font: 121 case Resource::Font:
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 665 }
666 666
667 ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc hRequest& request) 667 ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc hRequest& request)
668 { 668 {
669 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || type == Resource::Raw); 669 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || type == Resource::Raw);
670 670
671 TRACE_EVENT0("webkit", "ResourceFetcher::requestResource"); 671 TRACE_EVENT0("webkit", "ResourceFetcher::requestResource");
672 672
673 KURL url = request.resourceRequest().url(); 673 KURL url = request.resourceRequest().url();
674 674
675 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource '%s', charset '%s ', priority=%d, forPreload=%u, type=%s", url.elidedString().latin1().data(), req uest.charset().latin1().data(), request.priority(), request.forPreload(), Resour ceTypeName(type)); 675 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource '%s', charset '%s ', priority=%d, forPreload=%u, type=%s", url.elidedString().latin1().data(), req uest.charset().latin1().data(), request.resourceRequest().priority(), request.fo rPreload(), ResourceTypeName(type));
676 676
677 // If only the fragment identifiers differ, it is the same resource. 677 // If only the fragment identifiers differ, it is the same resource.
678 url = MemoryCache::removeFragmentIdentifierIfNeeded(url); 678 url = MemoryCache::removeFragmentIdentifierIfNeeded(url);
679 679
680 if (!url.isValid()) 680 if (!url.isValid())
681 return 0; 681 return 0;
682 682
683 if (!canRequest(type, url, request.options(), request.forPreload(), request. originRestriction())) 683 if (!canRequest(type, url, request.options(), request.forPreload(), request. originRestriction()))
684 return 0; 684 return 0;
685 685
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 } 1480 }
1481 } 1481 }
1482 1482
1483 void ResourceFetcher::trace(Visitor* visitor) 1483 void ResourceFetcher::trace(Visitor* visitor)
1484 { 1484 {
1485 visitor->trace(m_document); 1485 visitor->trace(m_document);
1486 ResourceLoaderHost::trace(visitor); 1486 ResourceLoaderHost::trace(visitor);
1487 } 1487 }
1488 1488
1489 } 1489 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698