Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp

Issue 2701753003: [WIP] off-main-thread loading
Patch Set: small fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698