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

Side by Side Diff: third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp

Issue 2715803004: Introduce ThreadableLoadingContext: make threaded loading code one step away from Document (Closed)
Patch Set: . Created 3 years, 9 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) 2010, 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/WebAssociatedURLLoaderImpl.h" 31 #include "web/WebAssociatedURLLoaderImpl.h"
32 32
33 #include <limits.h>
34 #include <memory>
33 #include "core/dom/ContextLifecycleObserver.h" 35 #include "core/dom/ContextLifecycleObserver.h"
34 #include "core/dom/TaskRunnerHelper.h" 36 #include "core/dom/TaskRunnerHelper.h"
35 #include "core/loader/DocumentThreadableLoader.h" 37 #include "core/loader/DocumentThreadableLoader.h"
36 #include "core/loader/DocumentThreadableLoaderClient.h" 38 #include "core/loader/DocumentThreadableLoaderClient.h"
39 #include "core/loader/ThreadableLoadingContext.h"
37 #include "platform/Timer.h" 40 #include "platform/Timer.h"
38 #include "platform/exported/WrappedResourceRequest.h" 41 #include "platform/exported/WrappedResourceRequest.h"
39 #include "platform/exported/WrappedResourceResponse.h" 42 #include "platform/exported/WrappedResourceResponse.h"
40 #include "platform/loader/fetch/CrossOriginAccessControl.h" 43 #include "platform/loader/fetch/CrossOriginAccessControl.h"
41 #include "platform/loader/fetch/FetchUtils.h" 44 #include "platform/loader/fetch/FetchUtils.h"
42 #include "platform/network/HTTPParsers.h" 45 #include "platform/network/HTTPParsers.h"
43 #include "platform/network/ResourceError.h" 46 #include "platform/network/ResourceError.h"
44 #include "public/platform/WebHTTPHeaderVisitor.h" 47 #include "public/platform/WebHTTPHeaderVisitor.h"
45 #include "public/platform/WebString.h" 48 #include "public/platform/WebString.h"
46 #include "public/platform/WebURLError.h" 49 #include "public/platform/WebURLError.h"
47 #include "public/platform/WebURLRequest.h" 50 #include "public/platform/WebURLRequest.h"
48 #include "public/web/WebAssociatedURLLoaderClient.h" 51 #include "public/web/WebAssociatedURLLoaderClient.h"
49 #include "public/web/WebDataSource.h" 52 #include "public/web/WebDataSource.h"
50 #include "web/WebLocalFrameImpl.h" 53 #include "web/WebLocalFrameImpl.h"
51 #include "wtf/HashSet.h" 54 #include "wtf/HashSet.h"
52 #include "wtf/PtrUtil.h" 55 #include "wtf/PtrUtil.h"
53 #include "wtf/text/WTFString.h" 56 #include "wtf/text/WTFString.h"
54 #include <limits.h>
55 #include <memory>
56 57
57 namespace blink { 58 namespace blink {
58 59
59 namespace { 60 namespace {
60 61
61 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { 62 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor {
62 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); 63 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator);
63 64
64 public: 65 public:
65 HTTPRequestHeaderValidator() : m_isSafe(true) {} 66 HTTPRequestHeaderValidator() : m_isSafe(true) {}
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 // FIXME: We load URLs without setting a TargetType (and therefore a 415 // FIXME: We load URLs without setting a TargetType (and therefore a
415 // request context) in several places in content/ 416 // request context) in several places in content/
416 // (P2PPortAllocatorSession::AllocateLegacyRelaySession, for example). 417 // (P2PPortAllocatorSession::AllocateLegacyRelaySession, for example).
417 // Remove this once those places are patched up. 418 // Remove this once those places are patched up.
418 newRequest.setRequestContext(WebURLRequest::RequestContextInternal); 419 newRequest.setRequestContext(WebURLRequest::RequestContextInternal);
419 } 420 }
420 421
421 Document* document = toDocument(m_observer->lifecycleContext()); 422 Document* document = toDocument(m_observer->lifecycleContext());
422 DCHECK(document); 423 DCHECK(document);
423 m_loader = DocumentThreadableLoader::create( 424 m_loader = DocumentThreadableLoader::create(
424 *document, m_clientAdapter.get(), options, resourceLoaderOptions); 425 *ThreadableLoadingContext::create(*document), m_clientAdapter.get(),
426 options, resourceLoaderOptions);
425 m_loader->start(webcoreRequest); 427 m_loader->start(webcoreRequest);
426 } 428 }
427 429
428 if (!m_loader) { 430 if (!m_loader) {
429 // FIXME: return meaningful error codes. 431 // FIXME: return meaningful error codes.
430 m_clientAdapter->didFail(ResourceError()); 432 m_clientAdapter->didFail(ResourceError());
431 } 433 }
432 m_clientAdapter->enableErrorNotifications(); 434 m_clientAdapter->enableErrorNotifications();
433 } 435 }
434 436
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // there could be a WebURLLoader instance behind the 498 // there could be a WebURLLoader instance behind the
497 // DocumentThreadableLoader instance. So, for safety, we chose to just 499 // DocumentThreadableLoader instance. So, for safety, we chose to just
498 // crash here. 500 // crash here.
499 CHECK(ThreadState::current()); 501 CHECK(ThreadState::current());
500 502
501 m_observer->dispose(); 503 m_observer->dispose();
502 m_observer = nullptr; 504 m_observer = nullptr;
503 } 505 }
504 506
505 } // namespace blink 507 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698