| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "core/loader/DocumentThreadableLoader.h" | 32 #include "core/loader/DocumentThreadableLoader.h" |
| 33 | 33 |
| 34 #include <memory> | 34 #include <memory> |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/TaskRunnerHelper.h" | 36 #include "core/dom/TaskRunnerHelper.h" |
| 37 #include "core/frame/FrameConsole.h" | 37 #include "core/frame/FrameConsole.h" |
| 38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 39 #include "core/frame/LocalFrameClient.h" |
| 39 #include "core/inspector/InspectorInstrumentation.h" | 40 #include "core/inspector/InspectorInstrumentation.h" |
| 40 #include "core/inspector/InspectorTraceEvents.h" | 41 #include "core/inspector/InspectorTraceEvents.h" |
| 41 #include "core/loader/DocumentThreadableLoaderClient.h" | 42 #include "core/loader/DocumentThreadableLoaderClient.h" |
| 42 #include "core/loader/FrameLoader.h" | 43 #include "core/loader/FrameLoader.h" |
| 43 #include "core/loader/FrameLoaderClient.h" | |
| 44 #include "core/loader/ThreadableLoaderClient.h" | 44 #include "core/loader/ThreadableLoaderClient.h" |
| 45 #include "core/loader/private/CrossOriginPreflightResultCache.h" | 45 #include "core/loader/private/CrossOriginPreflightResultCache.h" |
| 46 #include "core/page/ChromeClient.h" | 46 #include "core/page/ChromeClient.h" |
| 47 #include "core/page/Page.h" | 47 #include "core/page/Page.h" |
| 48 #include "platform/SharedBuffer.h" | 48 #include "platform/SharedBuffer.h" |
| 49 #include "platform/loader/fetch/CrossOriginAccessControl.h" | 49 #include "platform/loader/fetch/CrossOriginAccessControl.h" |
| 50 #include "platform/loader/fetch/FetchRequest.h" | 50 #include "platform/loader/fetch/FetchRequest.h" |
| 51 #include "platform/loader/fetch/FetchUtils.h" | 51 #include "platform/loader/fetch/FetchUtils.h" |
| 52 #include "platform/loader/fetch/Resource.h" | 52 #include "platform/loader/fetch/Resource.h" |
| 53 #include "platform/loader/fetch/ResourceFetcher.h" | 53 #include "platform/loader/fetch/ResourceFetcher.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 void DocumentThreadableLoader::cancel() { | 450 void DocumentThreadableLoader::cancel() { |
| 451 // Cancel can re-enter, and therefore |resource()| might be null here as a | 451 // Cancel can re-enter, and therefore |resource()| might be null here as a |
| 452 // result. | 452 // result. |
| 453 if (!m_client || !resource()) { | 453 if (!m_client || !resource()) { |
| 454 clear(); | 454 clear(); |
| 455 return; | 455 return; |
| 456 } | 456 } |
| 457 | 457 |
| 458 // FIXME: This error is sent to the client in didFail(), so it should not be | 458 // FIXME: This error is sent to the client in didFail(), so it should not be |
| 459 // an internal one. Use FrameLoaderClient::cancelledError() instead. | 459 // an internal one. Use LocalFrameClient::cancelledError() instead. |
| 460 ResourceError error(errorDomainBlinkInternal, 0, resource()->url(), | 460 ResourceError error(errorDomainBlinkInternal, 0, resource()->url(), |
| 461 "Load cancelled"); | 461 "Load cancelled"); |
| 462 error.setIsCancellation(true); | 462 error.setIsCancellation(true); |
| 463 | 463 |
| 464 dispatchDidFail(error); | 464 dispatchDidFail(error); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void DocumentThreadableLoader::setDefersLoading(bool value) { | 467 void DocumentThreadableLoader::setDefersLoading(bool value) { |
| 468 if (resource()) | 468 if (resource()) |
| 469 resource()->setDefersLoading(value); | 469 resource()->setDefersLoading(value); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 // clearResource() may be called in clear() and some other places. clear() | 926 // clearResource() may be called in clear() and some other places. clear() |
| 927 // calls stop() on |m_timeoutTimer|. In the other places, the resource is set | 927 // calls stop() on |m_timeoutTimer|. In the other places, the resource is set |
| 928 // again. If the creation fails, clear() is called. So, here, resource() is | 928 // again. If the creation fails, clear() is called. So, here, resource() is |
| 929 // always non-nullptr. | 929 // always non-nullptr. |
| 930 DCHECK(resource()); | 930 DCHECK(resource()); |
| 931 // When |m_client| is set to nullptr only in clear() where |m_timeoutTimer| | 931 // When |m_client| is set to nullptr only in clear() where |m_timeoutTimer| |
| 932 // is stopped. So, |m_client| is always non-nullptr here. | 932 // is stopped. So, |m_client| is always non-nullptr here. |
| 933 DCHECK(m_client); | 933 DCHECK(m_client); |
| 934 | 934 |
| 935 // Using values from net/base/net_error_list.h ERR_TIMED_OUT, Same as existing | 935 // Using values from net/base/net_error_list.h ERR_TIMED_OUT, Same as existing |
| 936 // FIXME above - this error should be coming from FrameLoaderClient to be | 936 // FIXME above - this error should be coming from LocalFrameClient to be |
| 937 // identifiable. | 937 // identifiable. |
| 938 static const int timeoutError = -7; | 938 static const int timeoutError = -7; |
| 939 ResourceError error("net", timeoutError, resource()->url(), String()); | 939 ResourceError error("net", timeoutError, resource()->url(), String()); |
| 940 error.setIsTimeout(true); | 940 error.setIsTimeout(true); |
| 941 | 941 |
| 942 dispatchDidFail(error); | 942 dispatchDidFail(error); |
| 943 } | 943 } |
| 944 | 944 |
| 945 void DocumentThreadableLoader::loadFallbackRequestForServiceWorker() { | 945 void DocumentThreadableLoader::loadFallbackRequestForServiceWorker() { |
| 946 clearResource(); | 946 clearResource(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 DEFINE_TRACE(DocumentThreadableLoader) { | 1151 DEFINE_TRACE(DocumentThreadableLoader) { |
| 1152 visitor->trace(m_resource); | 1152 visitor->trace(m_resource); |
| 1153 visitor->trace(m_document); | 1153 visitor->trace(m_document); |
| 1154 ThreadableLoader::trace(visitor); | 1154 ThreadableLoader::trace(visitor); |
| 1155 RawResourceClient::trace(visitor); | 1155 RawResourceClient::trace(visitor); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 } // namespace blink | 1158 } // namespace blink |
| OLD | NEW |