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

Side by Side Diff: Source/core/loader/DocumentThreadableLoader.cpp

Issue 1170503003: Remove resource type-specific fetching logic from ResourceFetcher (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null-check Document::loader() before calling startPreload() Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/loader/FrameFetchContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 resourceLoaderOptions.dataBufferingPolicy = BufferData; 578 resourceLoaderOptions.dataBufferingPolicy = BufferData;
579 579
580 if (m_options.timeoutMilliseconds > 0) 580 if (m_options.timeoutMilliseconds > 0)
581 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, FROM_HERE); 581 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, FROM_HERE);
582 582
583 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti ons); 583 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti ons);
584 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) 584 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
585 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction); 585 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
586 ASSERT(!resource()); 586 ASSERT(!resource());
587 if (request.requestContext() == WebURLRequest::RequestContextVideo || re quest.requestContext() == WebURLRequest::RequestContextAudio) 587 if (request.requestContext() == WebURLRequest::RequestContextVideo || re quest.requestContext() == WebURLRequest::RequestContextAudio)
588 setResource(m_document.fetcher()->fetchMedia(newRequest)); 588 setResource(RawResource::fetchMedia(newRequest, m_document.fetcher() ));
589 else 589 else
590 setResource(m_document.fetcher()->fetchRawResource(newRequest)); 590 setResource(RawResource::fetch(newRequest, m_document.fetcher()));
591 if (resource() && resource()->loader()) { 591 if (resource() && resource()->loader()) {
592 unsigned long identifier = resource()->identifier(); 592 unsigned long identifier = resource()->identifier();
593 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForC lient(&m_document, identifier, m_client); 593 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForC lient(&m_document, identifier, m_client);
594 } 594 }
595 return; 595 return;
596 } 596 }
597 597
598 FetchRequest fetchRequest(request, m_options.initiator, resourceLoaderOption s); 598 FetchRequest fetchRequest(request, m_options.initiator, resourceLoaderOption s);
599 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) 599 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
600 fetchRequest.setOriginRestriction(FetchRequest::NoOriginRestriction); 600 fetchRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
601 ResourcePtr<Resource> resource = m_document.fetcher()->fetchSynchronously(fe tchRequest); 601 ResourcePtr<Resource> resource = RawResource::fetchSynchronously(fetchReques t, m_document.fetcher());
602 ResourceResponse response = resource ? resource->response() : ResourceRespon se(); 602 ResourceResponse response = resource ? resource->response() : ResourceRespon se();
603 unsigned long identifier = resource ? resource->identifier() : std::numeric_ limits<unsigned long>::max(); 603 unsigned long identifier = resource ? resource->identifier() : std::numeric_ limits<unsigned long>::max();
604 ResourceError error = resource ? resource->resourceError() : ResourceError() ; 604 ResourceError error = resource ? resource->resourceError() : ResourceError() ;
605 605
606 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m _document, identifier, m_client); 606 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m _document, identifier, m_client);
607 607
608 if (!resource) { 608 if (!resource) {
609 m_client->didFail(error); 609 m_client->didFail(error);
610 return; 610 return;
611 } 611 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 return DoNotAllowStoredCredentials; 655 return DoNotAllowStoredCredentials;
656 return m_resourceLoaderOptions.allowCredentials; 656 return m_resourceLoaderOptions.allowCredentials;
657 } 657 }
658 658
659 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const 659 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
660 { 660 {
661 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); 661 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin ();
662 } 662 }
663 663
664 } // namespace blink 664 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/loader/FrameFetchContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698