OLD | NEW |
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 void ResourceLoader::requestSynchronously(const ResourceRequest& request) | 225 void ResourceLoader::requestSynchronously(const ResourceRequest& request) |
226 { | 226 { |
227 // downloadToFile is not supported for synchronous requests. | 227 // downloadToFile is not supported for synchronous requests. |
228 ASSERT(!request.downloadToFile()); | 228 ASSERT(!request.downloadToFile()); |
229 ASSERT(m_loader); | 229 ASSERT(m_loader); |
230 DCHECK(request.priority() == ResourceLoadPriorityHighest); | 230 DCHECK(request.priority() == ResourceLoadPriorityHighest); |
231 | 231 |
232 WrappedResourceRequest requestIn(request); | 232 WrappedResourceRequest requestIn(request); |
233 WebURLResponse responseOut; | 233 WebURLResponse responseOut; |
234 responseOut.initialize(); | |
235 WebURLError errorOut; | 234 WebURLError errorOut; |
236 WebData dataOut; | 235 WebData dataOut; |
237 m_loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut); | 236 m_loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut); |
238 | 237 |
239 // A message dispatched while synchronously fetching the resource | 238 // A message dispatched while synchronously fetching the resource |
240 // can bring about the cancellation of this load. | 239 // can bring about the cancellation of this load. |
241 if (!m_loader) | 240 if (!m_loader) |
242 return; | 241 return; |
243 if (errorOut.reason) { | 242 if (errorOut.reason) { |
244 didFail(0, errorOut); | 243 didFail(0, errorOut); |
(...skipping 10 matching lines...) Expand all Loading... |
255 // empty buffer is a noop in most cases, but is destructive in the case of | 254 // empty buffer is a noop in most cases, but is destructive in the case of |
256 // a 304, where it will overwrite the cached data we should be reusing. | 255 // a 304, where it will overwrite the cached data we should be reusing. |
257 if (dataOut.size()) { | 256 if (dataOut.size()) { |
258 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size
(), encodedDataLength); | 257 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size
(), encodedDataLength); |
259 m_resource->setResourceBuffer(dataOut); | 258 m_resource->setResourceBuffer(dataOut); |
260 } | 259 } |
261 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 260 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
262 } | 261 } |
263 | 262 |
264 } // namespace blink | 263 } // namespace blink |
OLD | NEW |