| OLD | NEW |
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (!m_client) | 183 if (!m_client) |
| 184 return; | 184 return; |
| 185 | 185 |
| 186 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); | 186 m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void AssociatedURLLoader::ClientAdapter::didReceiveResponse( | 189 void AssociatedURLLoader::ClientAdapter::didReceiveResponse( |
| 190 unsigned long, | 190 unsigned long, |
| 191 const ResourceResponse& response, | 191 const ResourceResponse& response, |
| 192 std::unique_ptr<WebDataConsumerHandle> handle) { | 192 std::unique_ptr<WebDataConsumerHandle> handle) { |
| 193 ASSERT_UNUSED(handle, !handle); | 193 DCHECK(!handle); |
| 194 if (!m_client) | 194 if (!m_client) |
| 195 return; | 195 return; |
| 196 | 196 |
| 197 if (m_options.exposeAllResponseHeaders || | 197 if (m_options.exposeAllResponseHeaders || |
| 198 m_options.crossOriginRequestPolicy != | 198 m_options.crossOriginRequestPolicy != |
| 199 WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl) { | 199 WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl) { |
| 200 // Use the original ResourceResponse. | 200 // Use the original ResourceResponse. |
| 201 m_client->didReceiveResponse(m_loader, WrappedResourceResponse(response)); | 201 m_client->didReceiveResponse(m_loader, WrappedResourceResponse(response)); |
| 202 return; | 202 return; |
| 203 } | 203 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 void AssociatedURLLoader::ClientAdapter::enableErrorNotifications() { | 283 void AssociatedURLLoader::ClientAdapter::enableErrorNotifications() { |
| 284 m_enableErrorNotifications = true; | 284 m_enableErrorNotifications = true; |
| 285 // If an error has already been received, start a timer to report it to the | 285 // If an error has already been received, start a timer to report it to the |
| 286 // client after AssociatedURLLoader::loadAsynchronously has returned to the | 286 // client after AssociatedURLLoader::loadAsynchronously has returned to the |
| 287 // caller. | 287 // caller. |
| 288 if (m_didFail) | 288 if (m_didFail) |
| 289 m_errorTimer.startOneShot(0, BLINK_FROM_HERE); | 289 m_errorTimer.startOneShot(0, BLINK_FROM_HERE); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void AssociatedURLLoader::ClientAdapter::notifyError(TimerBase* timer) { | 292 void AssociatedURLLoader::ClientAdapter::notifyError(TimerBase* timer) { |
| 293 ASSERT_UNUSED(timer, timer == &m_errorTimer); | 293 DCHECK_EQ(timer, &m_errorTimer); |
| 294 | 294 |
| 295 if (!m_client) | 295 if (m_client) |
| 296 return; | 296 releaseClient()->didFail(m_loader, m_error); |
| 297 | |
| 298 releaseClient()->didFail(m_loader, m_error); | |
| 299 // |this| may be dead here. | 297 // |this| may be dead here. |
| 300 } | 298 } |
| 301 | 299 |
| 302 class AssociatedURLLoader::Observer final : public GarbageCollected<Observer>, | 300 class AssociatedURLLoader::Observer final : public GarbageCollected<Observer>, |
| 303 public ContextLifecycleObserver { | 301 public ContextLifecycleObserver { |
| 304 USING_GARBAGE_COLLECTED_MIXIN(Observer); | 302 USING_GARBAGE_COLLECTED_MIXIN(Observer); |
| 305 | 303 |
| 306 public: | 304 public: |
| 307 Observer(AssociatedURLLoader* parent, Document* document) | 305 Observer(AssociatedURLLoader* parent, Document* document) |
| 308 : ContextLifecycleObserver(document), m_parent(parent) {} | 306 : ContextLifecycleObserver(document), m_parent(parent) {} |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // there could be a WebURLLoader instance behind the | 480 // there could be a WebURLLoader instance behind the |
| 483 // DocumentThreadableLoader instance. So, for safety, we chose to just | 481 // DocumentThreadableLoader instance. So, for safety, we chose to just |
| 484 // crash here. | 482 // crash here. |
| 485 RELEASE_ASSERT(ThreadState::current()); | 483 RELEASE_ASSERT(ThreadState::current()); |
| 486 | 484 |
| 487 m_observer->dispose(); | 485 m_observer->dispose(); |
| 488 m_observer = nullptr; | 486 m_observer = nullptr; |
| 489 } | 487 } |
| 490 | 488 |
| 491 } // namespace blink | 489 } // namespace blink |
| OLD | NEW |