Chromium Code Reviews| 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 |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 805 RESOURCE_LOADING_DVLOG(1) << "Loading Resource for " | 805 RESOURCE_LOADING_DVLOG(1) << "Loading Resource for " |
| 806 << params.GetResourceRequest().Url().ElidedString(); | 806 << params.GetResourceRequest().Url().ElidedString(); |
| 807 | 807 |
| 808 Resource* resource = | 808 Resource* resource = |
| 809 factory.Create(params.GetResourceRequest(), params.Options(), charset); | 809 factory.Create(params.GetResourceRequest(), params.Options(), charset); |
| 810 resource->SetLinkPreload(params.IsLinkPreload()); | 810 resource->SetLinkPreload(params.IsLinkPreload()); |
| 811 if (params.IsSpeculativePreload()) { | 811 if (params.IsSpeculativePreload()) { |
| 812 resource->SetPreloadDiscoveryTime(params.PreloadDiscoveryTime()); | 812 resource->SetPreloadDiscoveryTime(params.PreloadDiscoveryTime()); |
| 813 } | 813 } |
| 814 resource->SetCacheIdentifier(cache_identifier); | 814 resource->SetCacheIdentifier(cache_identifier); |
| 815 resource->SetIntegrityMetadata(params.IntegrityMetadata()); | |
|
xiaofengzhang
2017/06/19 03:17:05
This is not needed, will delete later
| |
| 816 resource->SetIntegrityValue(params.IntegrityValue()); | |
|
shimazu
2017/06/26 06:13:32
Also, this won't be needed if you set the value of
xiaofengzhang
2017/06/29 02:26:06
Done.
| |
| 815 | 817 |
| 816 if (ShouldResourceBeAddedToMemoryCache(params, resource)) | 818 if (ShouldResourceBeAddedToMemoryCache(params, resource)) |
| 817 GetMemoryCache()->Add(resource); | 819 GetMemoryCache()->Add(resource); |
| 818 return resource; | 820 return resource; |
| 819 } | 821 } |
| 820 | 822 |
| 821 void ResourceFetcher::StorePerformanceTimingInitiatorInformation( | 823 void ResourceFetcher::StorePerformanceTimingInitiatorInformation( |
| 822 Resource* resource) { | 824 Resource* resource) { |
| 823 const AtomicString& fetch_initiator = resource->Options().initiator_info.name; | 825 const AtomicString& fetch_initiator = resource->Options().initiator_info.name; |
| 824 if (fetch_initiator == FetchInitiatorTypeNames::internal) | 826 if (fetch_initiator == FetchInitiatorTypeNames::internal) |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 983 return true; | 985 return true; |
| 984 } | 986 } |
| 985 | 987 |
| 986 ResourceFetcher::RevalidationPolicy | 988 ResourceFetcher::RevalidationPolicy |
| 987 ResourceFetcher::DetermineRevalidationPolicy( | 989 ResourceFetcher::DetermineRevalidationPolicy( |
| 988 Resource::Type type, | 990 Resource::Type type, |
| 989 const FetchParameters& fetch_params, | 991 const FetchParameters& fetch_params, |
| 990 Resource* existing_resource, | 992 Resource* existing_resource, |
| 991 bool is_static_data) const { | 993 bool is_static_data) const { |
| 992 const ResourceRequest& request = fetch_params.GetResourceRequest(); | 994 const ResourceRequest& request = fetch_params.GetResourceRequest(); |
| 993 | |
| 994 if (!existing_resource) | 995 if (!existing_resource) |
| 995 return kLoad; | 996 return kLoad; |
| 996 | 997 |
| 997 // If the existing resource is loading and the associated fetcher is not equal | 998 // If the existing resource is loading and the associated fetcher is not equal |
| 998 // to |this|, we must not use the resource. Otherwise, CSP violation may | 999 // to |this|, we must not use the resource. Otherwise, CSP violation may |
| 999 // happen in redirect handling. | 1000 // happen in redirect handling. |
| 1000 if (existing_resource->Loader() && | 1001 if (existing_resource->Loader() && |
| 1001 existing_resource->Loader()->Fetcher() != this) { | 1002 existing_resource->Loader()->Fetcher() != this) { |
| 1002 return kReload; | 1003 return kReload; |
| 1003 } | 1004 } |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1372 non_blocking_loaders_.insert(loader); | 1373 non_blocking_loaders_.insert(loader); |
| 1373 loaders_.erase(loader); | 1374 loaders_.erase(loader); |
| 1374 } | 1375 } |
| 1375 | 1376 |
| 1376 bool ResourceFetcher::StartLoad(Resource* resource) { | 1377 bool ResourceFetcher::StartLoad(Resource* resource) { |
| 1377 DCHECK(resource); | 1378 DCHECK(resource); |
| 1378 DCHECK(resource->StillNeedsLoad()); | 1379 DCHECK(resource->StillNeedsLoad()); |
| 1379 | 1380 |
| 1380 ResourceRequest request(resource->GetResourceRequest()); | 1381 ResourceRequest request(resource->GetResourceRequest()); |
| 1381 ResourceLoader* loader = nullptr; | 1382 ResourceLoader* loader = nullptr; |
| 1383 request.SetFetchIntegrity(AtomicString(resource->IntegrityValue())); | |
|
shimazu
2017/06/26 06:13:32
You won't be needed if the request returned by res
xiaofengzhang
2017/06/29 02:26:06
Done.
| |
| 1382 | 1384 |
| 1383 { | 1385 { |
| 1384 // Forbids JavaScript/addClient/removeClient/revalidation until start() | 1386 // Forbids JavaScript/addClient/removeClient/revalidation until start() |
| 1385 // to prevent unintended state transitions. | 1387 // to prevent unintended state transitions. |
| 1386 Resource::ProhibitAddRemoveClientInScope | 1388 Resource::ProhibitAddRemoveClientInScope |
| 1387 prohibit_add_remove_client_in_scope(resource); | 1389 prohibit_add_remove_client_in_scope(resource); |
| 1388 Resource::RevalidationStartForbiddenScope | 1390 Resource::RevalidationStartForbiddenScope |
| 1389 revalidation_start_forbidden_scope(resource); | 1391 revalidation_start_forbidden_scope(resource); |
| 1390 ScriptForbiddenIfMainThreadScope script_forbidden_scope; | 1392 ScriptForbiddenIfMainThreadScope script_forbidden_scope; |
| 1391 | 1393 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1666 visitor->Trace(archive_); | 1668 visitor->Trace(archive_); |
| 1667 visitor->Trace(loaders_); | 1669 visitor->Trace(loaders_); |
| 1668 visitor->Trace(non_blocking_loaders_); | 1670 visitor->Trace(non_blocking_loaders_); |
| 1669 visitor->Trace(document_resources_); | 1671 visitor->Trace(document_resources_); |
| 1670 visitor->Trace(preloads_); | 1672 visitor->Trace(preloads_); |
| 1671 visitor->Trace(matched_preloads_); | 1673 visitor->Trace(matched_preloads_); |
| 1672 visitor->Trace(resource_timing_info_map_); | 1674 visitor->Trace(resource_timing_info_map_); |
| 1673 } | 1675 } |
| 1674 | 1676 |
| 1675 } // namespace blink | 1677 } // namespace blink |
| OLD | NEW |