| 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(!loader_); | 78 DCHECK(!loader_); |
| 79 | 79 |
| 80 if (resource_->Options().synchronous_policy == kRequestSynchronously && | 80 if (resource_->Options().synchronous_policy == kRequestSynchronously && |
| 81 Context().DefersLoading()) { | 81 Context().DefersLoading()) { |
| 82 Cancel(); | 82 Cancel(); |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 | 85 |
| 86 loader_ = Platform::Current()->CreateURLLoader(); | 86 loader_ = Context().CreateURLLoader(); |
| 87 DCHECK(loader_); | 87 DCHECK(loader_); |
| 88 loader_->SetDefersLoading(Context().DefersLoading()); | 88 loader_->SetDefersLoading(Context().DefersLoading()); |
| 89 loader_->SetLoadingTaskRunner(Context().LoadingTaskRunner().Get()); | 89 loader_->SetLoadingTaskRunner(Context().LoadingTaskRunner().Get()); |
| 90 | 90 |
| 91 if (is_cache_aware_loading_activated_) { | 91 if (is_cache_aware_loading_activated_) { |
| 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 cache_aware_request(request); | 94 ResourceRequest cache_aware_request(request); |
| 95 cache_aware_request.SetCachePolicy(WebCachePolicy::kReturnCacheDataIfValid); | 95 cache_aware_request.SetCachePolicy(WebCachePolicy::kReturnCacheDataIfValid); |
| 96 loader_->LoadAsynchronously(WrappedResourceRequest(cache_aware_request), | 96 loader_->LoadAsynchronously(WrappedResourceRequest(cache_aware_request), |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 return; | 527 return; |
| 528 | 528 |
| 529 // Don't activate if cache policy is explicitly set. | 529 // Don't activate if cache policy is explicitly set. |
| 530 if (request.GetCachePolicy() != WebCachePolicy::kUseProtocolCachePolicy) | 530 if (request.GetCachePolicy() != WebCachePolicy::kUseProtocolCachePolicy) |
| 531 return; | 531 return; |
| 532 | 532 |
| 533 is_cache_aware_loading_activated_ = true; | 533 is_cache_aware_loading_activated_ = true; |
| 534 } | 534 } |
| 535 | 535 |
| 536 } // namespace blink | 536 } // namespace blink |
| OLD | NEW |