Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) | 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ResourceLoader::start(const ResourceRequest& request, | 74 void ResourceLoader::start(const ResourceRequest& request, |
| 75 WebTaskRunner* loadingTaskRunner, | 75 WebTaskRunner* loadingTaskRunner, |
| 76 bool defersLoading) { | 76 bool defersLoading) { |
| 77 DCHECK(!m_loader); | 77 DCHECK(!m_loader); |
| 78 if (m_resource->options().synchronousPolicy == RequestSynchronously && | 78 if (m_resource->options().synchronousPolicy == RequestSynchronously && |
| 79 defersLoading) { | 79 defersLoading) { |
| 80 cancel(); | 80 cancel(); |
| 81 return; | 81 return; |
| 82 } | 82 } |
|
panicker
2016/12/08 20:47:06
revert this file?
sunjian
2016/12/09 00:50:12
Done.
| |
| 83 | |
| 84 m_loader = wrapUnique(Platform::current()->createURLLoader()); | 83 m_loader = wrapUnique(Platform::current()->createURLLoader()); |
| 85 DCHECK(m_loader); | 84 DCHECK(m_loader); |
| 86 m_loader->setDefersLoading(defersLoading); | 85 m_loader->setDefersLoading(defersLoading); |
| 87 m_loader->setLoadingTaskRunner(loadingTaskRunner); | 86 m_loader->setLoadingTaskRunner(loadingTaskRunner); |
| 88 | 87 |
| 89 if (m_isCacheAwareLoadingActivated) { | 88 if (m_isCacheAwareLoadingActivated) { |
| 90 // Override cache policy for cache-aware loading. If this request fails, a | 89 // Override cache policy for cache-aware loading. If this request fails, a |
| 91 // reload with original request will be triggered in didFail(). | 90 // reload with original request will be triggered in didFail(). |
| 92 ResourceRequest cacheAwareRequest(request); | 91 ResourceRequest cacheAwareRequest(request); |
| 93 cacheAwareRequest.setCachePolicy(WebCachePolicy::ReturnCacheDataIfValid); | 92 cacheAwareRequest.setCachePolicy(WebCachePolicy::ReturnCacheDataIfValid); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 return; | 311 return; |
| 313 | 312 |
| 314 // Don't activate if cache policy is explicitly set. | 313 // Don't activate if cache policy is explicitly set. |
| 315 if (request.getCachePolicy() != WebCachePolicy::UseProtocolCachePolicy) | 314 if (request.getCachePolicy() != WebCachePolicy::UseProtocolCachePolicy) |
| 316 return; | 315 return; |
| 317 | 316 |
| 318 m_isCacheAwareLoadingActivated = true; | 317 m_isCacheAwareLoadingActivated = true; |
| 319 } | 318 } |
| 320 | 319 |
| 321 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |