| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void didReceiveResponse(WebURLLoader*, const WebURLResponse&, WebDataConsume
rHandle*) override; | 80 void didReceiveResponse(WebURLLoader*, const WebURLResponse&, WebDataConsume
rHandle*) override; |
| 81 void didReceiveData(WebURLLoader*, const char*, int, int encodedDataLength)
override; | 81 void didReceiveData(WebURLLoader*, const char*, int, int encodedDataLength)
override; |
| 82 void didReceiveCachedMetadata(WebURLLoader*, const char* data, int length) o
verride; | 82 void didReceiveCachedMetadata(WebURLLoader*, const char* data, int length) o
verride; |
| 83 void didFinishLoading(WebURLLoader*, double finishTime, int64_t encodedDataL
ength) override; | 83 void didFinishLoading(WebURLLoader*, double finishTime, int64_t encodedDataL
ength) override; |
| 84 void didFail(WebURLLoader*, const WebURLError&) override; | 84 void didFail(WebURLLoader*, const WebURLError&) override; |
| 85 void didDownloadData(WebURLLoader*, int, int) override; | 85 void didDownloadData(WebURLLoader*, int, int) override; |
| 86 | 86 |
| 87 const KURL& url() const { return m_request.url(); } | 87 const KURL& url() const { return m_request.url(); } |
| 88 bool isLoadedBy(ResourceFetcher*) const; | 88 bool isLoadedBy(ResourceFetcher*) const; |
| 89 | 89 |
| 90 bool reachedTerminalState() const { return m_state == Terminated; } | |
| 91 const ResourceRequest& request() const { return m_request; } | 90 const ResourceRequest& request() const { return m_request; } |
| 92 | 91 |
| 93 bool loadingMultipartContent() const { return m_loadingMultipartContent; } | 92 bool loadingMultipartContent() const { return m_loadingMultipartContent; } |
| 94 | 93 |
| 95 private: | 94 private: |
| 96 // Assumes ResourceFetcher and Resource are non-null. | 95 // Assumes ResourceFetcher and Resource are non-null. |
| 97 ResourceLoader(ResourceFetcher*, Resource*, const ResourceLoaderOptions&); | 96 ResourceLoader(ResourceFetcher*, Resource*, const ResourceLoaderOptions&); |
| 98 | 97 |
| 99 void init(const ResourceRequest&); | 98 void init(const ResourceRequest&); |
| 100 void requestSynchronously(); | 99 void requestSynchronously(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 111 ResourceRequest m_request; | 110 ResourceRequest m_request; |
| 112 ResourceRequest m_originalRequest; // Before redirects. | 111 ResourceRequest m_originalRequest; // Before redirects. |
| 113 | 112 |
| 114 bool m_notifiedLoadComplete; | 113 bool m_notifiedLoadComplete; |
| 115 | 114 |
| 116 bool m_defersLoading; | 115 bool m_defersLoading; |
| 117 bool m_loadingMultipartContent; | 116 bool m_loadingMultipartContent; |
| 118 ResourceRequest m_deferredRequest; | 117 ResourceRequest m_deferredRequest; |
| 119 ResourceLoaderOptions m_options; | 118 ResourceLoaderOptions m_options; |
| 120 | 119 |
| 121 enum ResourceLoaderState { | |
| 122 Initialized, | |
| 123 Finishing, | |
| 124 Terminated | |
| 125 }; | |
| 126 | |
| 127 enum ConnectionState { | 120 enum ConnectionState { |
| 128 ConnectionStateNew, | 121 ConnectionStateNew, |
| 129 ConnectionStateStarted, | 122 ConnectionStateStarted, |
| 130 ConnectionStateReceivedResponse, | 123 ConnectionStateReceivedResponse, |
| 131 ConnectionStateReceivingData, | 124 ConnectionStateReceivingData, |
| 132 ConnectionStateFinishedLoading, | 125 ConnectionStateFinishedLoading, |
| 133 ConnectionStateCanceled, | 126 ConnectionStateCanceled, |
| 134 ConnectionStateFailed, | 127 ConnectionStateFailed, |
| 128 ConnectionStateReleased |
| 135 }; | 129 }; |
| 130 bool isFinishing() { return m_state >= ConnectionStateFinishedLoading && m_s
tate <= ConnectionStateFailed; } |
| 136 | 131 |
| 137 RefPtrWillBeMember<Resource> m_resource; | 132 RefPtrWillBeMember<Resource> m_resource; |
| 138 ResourceLoaderState m_state; | |
| 139 | 133 |
| 140 // Used for sanity checking to make sure we don't experience illegal state | 134 // Used for sanity checking to make sure we don't experience illegal state |
| 141 // transitions. | 135 // transitions. |
| 142 ConnectionState m_connectionState; | 136 ConnectionState m_state; |
| 143 }; | 137 }; |
| 144 | 138 |
| 145 } // namespace blink | 139 } // namespace blink |
| 146 | 140 |
| 147 #endif | 141 #endif |
| OLD | NEW |