OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. |
3 * Copyright (C) 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2010 Apple Inc. All rights reserved. |
4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. | 4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 void EventSource::didFailRedirectCheck() | 309 void EventSource::didFailRedirectCheck() |
310 { | 310 { |
311 abortConnectionAttempt(); | 311 abortConnectionAttempt(); |
312 } | 312 } |
313 | 313 |
314 void EventSource::abortConnectionAttempt() | 314 void EventSource::abortConnectionAttempt() |
315 { | 315 { |
316 ASSERT(m_state == CONNECTING); | 316 ASSERT(m_state == CONNECTING); |
317 | 317 |
318 if (m_requestInFlight) { | 318 m_loader = nullptr; |
319 m_loader->cancel(); | 319 m_state = CLOSED; |
320 } else { | 320 networkRequestEnded(); |
321 m_state = CLOSED; | |
322 } | |
323 | 321 |
324 ASSERT(m_state == CLOSED); | |
325 dispatchEvent(Event::create(EventTypeNames::error)); | 322 dispatchEvent(Event::create(EventTypeNames::error)); |
326 } | 323 } |
327 | 324 |
328 void EventSource::parseEventStream() | 325 void EventSource::parseEventStream() |
329 { | 326 { |
330 unsigned bufPos = 0; | 327 unsigned bufPos = 0; |
331 unsigned bufSize = m_receiveBuf.size(); | 328 unsigned bufSize = m_receiveBuf.size(); |
332 while (bufPos < bufSize) { | 329 while (bufPos < bufSize) { |
333 if (m_discardTrailingNewline) { | 330 if (m_discardTrailingNewline) { |
334 if (m_receiveBuf[bufPos] == '\n') | 331 if (m_receiveBuf[bufPos] == '\n') |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 return event.release(); | 442 return event.release(); |
446 } | 443 } |
447 | 444 |
448 DEFINE_TRACE(EventSource) | 445 DEFINE_TRACE(EventSource) |
449 { | 446 { |
450 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); | 447 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); |
451 ActiveDOMObject::trace(visitor); | 448 ActiveDOMObject::trace(visitor); |
452 } | 449 } |
453 | 450 |
454 } // namespace blink | 451 } // namespace blink |
OLD | NEW |