| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void ResourceLoader::start(const ResourceRequest& request) { | 77 void ResourceLoader::start(const ResourceRequest& request) { |
| 78 DCHECK(!m_loader); | 78 DCHECK(!m_loader); |
| 79 | 79 |
| 80 if (m_resource->options().synchronousPolicy == RequestSynchronously && | 80 if (m_resource->options().synchronousPolicy == RequestSynchronously && |
| 81 context().defersLoading()) { | 81 context().defersLoading()) { |
| 82 cancel(); | 82 cancel(); |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 | 85 |
| 86 m_loader = WTF::wrapUnique(Platform::current()->createURLLoader()); | 86 m_loader = WTF::wrapUnique(context().createURLLoader()); |
| 87 DCHECK(m_loader); | 87 DCHECK(m_loader); |
| 88 m_loader->setDefersLoading(context().defersLoading()); | 88 m_loader->setDefersLoading(context().defersLoading()); |
| 89 m_loader->setLoadingTaskRunner(context().loadingTaskRunner().get()); | 89 m_loader->setLoadingTaskRunner(context().loadingTaskRunner().get()); |
| 90 | 90 |
| 91 if (m_isCacheAwareLoadingActivated) { | 91 if (m_isCacheAwareLoadingActivated) { |
| 92 // Override cache policy for cache-aware loading. If this request fails, a | 92 // Override cache policy for cache-aware loading. If this request fails, a |
| 93 // reload with original request will be triggered in didFail(). | 93 // reload with original request will be triggered in didFail(). |
| 94 ResourceRequest cacheAwareRequest(request); | 94 ResourceRequest cacheAwareRequest(request); |
| 95 cacheAwareRequest.setCachePolicy(WebCachePolicy::ReturnCacheDataIfValid); | 95 cacheAwareRequest.setCachePolicy(WebCachePolicy::ReturnCacheDataIfValid); |
| 96 m_loader->loadAsynchronously(WrappedResourceRequest(cacheAwareRequest), | 96 m_loader->loadAsynchronously(WrappedResourceRequest(cacheAwareRequest), |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 return; | 521 return; |
| 522 | 522 |
| 523 // Don't activate if cache policy is explicitly set. | 523 // Don't activate if cache policy is explicitly set. |
| 524 if (request.getCachePolicy() != WebCachePolicy::UseProtocolCachePolicy) | 524 if (request.getCachePolicy() != WebCachePolicy::UseProtocolCachePolicy) |
| 525 return; | 525 return; |
| 526 | 526 |
| 527 m_isCacheAwareLoadingActivated = true; | 527 m_isCacheAwareLoadingActivated = true; |
| 528 } | 528 } |
| 529 | 529 |
| 530 } // namespace blink | 530 } // namespace blink |
| OLD | NEW |