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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 rights reserved. | 6 rights reserved. |
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
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 |
11 License as published by the Free Software Foundation; either | 11 License as published by the Free Software Foundation; either |
12 version 2 of the License, or (at your option) any later version. | 12 version 2 of the License, or (at your option) any later version. |
13 | 13 |
14 This library is distributed in the hope that it will be useful, | 14 This library is distributed in the hope that it will be useful, |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 Library General Public License for more details. | 17 Library General Public License for more details. |
18 | 18 |
19 You should have received a copy of the GNU Library General Public License | 19 You should have received a copy of the GNU Library General Public License |
20 along with this library; see the file COPYING.LIB. If not, write to | 20 along with this library; see the file COPYING.LIB. If not, write to |
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 Boston, MA 02110-1301, USA. | 22 Boston, MA 02110-1301, USA. |
23 | 23 |
24 This class provides all functionality needed for loading images, style | 24 This class provides all functionality needed for loading images, style |
25 sheets and html pages from the web. It has a memory cache for these objects. | 25 sheets and html pages from the web. It has a memory cache for these objects. |
26 */ | 26 */ |
27 | 27 |
28 #include "core/fetch/ResourceFetcher.h" | 28 #include "core/fetch/ResourceFetcher.h" |
29 | 29 |
30 #include "bindings/core/v8/V8DOMActivityLogger.h" | |
31 #include "core/fetch/FetchContext.h" | 30 #include "core/fetch/FetchContext.h" |
32 #include "core/fetch/FetchInitiatorTypeNames.h" | 31 #include "core/fetch/FetchInitiatorTypeNames.h" |
33 #include "core/fetch/MemoryCache.h" | 32 #include "core/fetch/MemoryCache.h" |
34 #include "core/fetch/ResourceLoader.h" | 33 #include "core/fetch/ResourceLoader.h" |
35 #include "core/fetch/ResourceLoadingLog.h" | 34 #include "core/fetch/ResourceLoadingLog.h" |
36 #include "core/fetch/UniqueIdentifier.h" | 35 #include "core/fetch/UniqueIdentifier.h" |
37 #include "platform/Histogram.h" | 36 #include "platform/Histogram.h" |
38 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
39 #include "platform/mhtml/ArchiveResource.h" | 38 #include "platform/mhtml/ArchiveResource.h" |
40 #include "platform/mhtml/MHTMLArchive.h" | 39 #include "platform/mhtml/MHTMLArchive.h" |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 ResourceRequestBlockedReason blockedReason = context().canRequest( | 483 ResourceRequestBlockedReason blockedReason = context().canRequest( |
485 factory.type(), request.resourceRequest(), | 484 factory.type(), request.resourceRequest(), |
486 MemoryCache::removeFragmentIdentifierIfNeeded(request.url()), | 485 MemoryCache::removeFragmentIdentifierIfNeeded(request.url()), |
487 request.options(), request.forPreload(), request.getOriginRestriction()); | 486 request.options(), request.forPreload(), request.getOriginRestriction()); |
488 if (blockedReason != ResourceRequestBlockedReason::None) { | 487 if (blockedReason != ResourceRequestBlockedReason::None) { |
489 DCHECK(!substituteData.forceSynchronousLoad()); | 488 DCHECK(!substituteData.forceSynchronousLoad()); |
490 return resourceForBlockedRequest(request, factory, blockedReason); | 489 return resourceForBlockedRequest(request, factory, blockedReason); |
491 } | 490 } |
492 | 491 |
493 context().willStartLoadingResource( | 492 context().willStartLoadingResource( |
494 identifier, request.mutableResourceRequest(), factory.type()); | 493 identifier, request.mutableResourceRequest(), factory.type(), |
| 494 request.options().initiatorInfo.name, request.forPreload()); |
495 if (!request.url().isValid()) | 495 if (!request.url().isValid()) |
496 return nullptr; | 496 return nullptr; |
497 | 497 |
498 if (!request.forPreload()) { | |
499 V8DOMActivityLogger* activityLogger = nullptr; | |
500 if (request.options().initiatorInfo.name == | |
501 FetchInitiatorTypeNames::xmlhttprequest) { | |
502 activityLogger = V8DOMActivityLogger::currentActivityLogger(); | |
503 } else { | |
504 activityLogger = | |
505 V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld(); | |
506 } | |
507 | |
508 if (activityLogger) { | |
509 Vector<String> argv; | |
510 argv.append(Resource::resourceTypeToString( | |
511 factory.type(), request.options().initiatorInfo.name)); | |
512 argv.append(request.url()); | |
513 activityLogger->logEvent("blinkRequestResource", argv.size(), | |
514 argv.data()); | |
515 } | |
516 } | |
517 | |
518 bool isDataUrl = request.resourceRequest().url().protocolIsData(); | 498 bool isDataUrl = request.resourceRequest().url().protocolIsData(); |
519 bool isStaticData = isDataUrl || substituteData.isValid() || m_archive; | 499 bool isStaticData = isDataUrl || substituteData.isValid() || m_archive; |
520 Resource* resource(nullptr); | 500 Resource* resource(nullptr); |
521 if (isStaticData) { | 501 if (isStaticData) { |
522 resource = resourceForStaticData(request, factory, substituteData); | 502 resource = resourceForStaticData(request, factory, substituteData); |
523 // Abort the request if the archive doesn't contain the resource, except in | 503 // Abort the request if the archive doesn't contain the resource, except in |
524 // the case of data URLs which might have resources such as fonts that need | 504 // the case of data URLs which might have resources such as fonts that need |
525 // to be decoded only on demand. These data URLs are allowed to be | 505 // to be decoded only on demand. These data URLs are allowed to be |
526 // processed using the normal ResourceFetcher machinery. | 506 // processed using the normal ResourceFetcher machinery. |
527 if (!resource && !isDataUrl && m_archive) | 507 if (!resource && !isDataUrl && m_archive) |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 visitor->trace(m_context); | 1502 visitor->trace(m_context); |
1523 visitor->trace(m_archive); | 1503 visitor->trace(m_archive); |
1524 visitor->trace(m_loaders); | 1504 visitor->trace(m_loaders); |
1525 visitor->trace(m_nonBlockingLoaders); | 1505 visitor->trace(m_nonBlockingLoaders); |
1526 visitor->trace(m_documentResources); | 1506 visitor->trace(m_documentResources); |
1527 visitor->trace(m_preloads); | 1507 visitor->trace(m_preloads); |
1528 visitor->trace(m_resourceTimingInfoMap); | 1508 visitor->trace(m_resourceTimingInfoMap); |
1529 } | 1509 } |
1530 | 1510 |
1531 } // namespace blink | 1511 } // namespace blink |
OLD | NEW |