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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 void EventSource::didFailRedirectCheck() | 313 void EventSource::didFailRedirectCheck() |
314 { | 314 { |
315 abortConnectionAttempt(); | 315 abortConnectionAttempt(); |
316 } | 316 } |
317 | 317 |
318 void EventSource::abortConnectionAttempt() | 318 void EventSource::abortConnectionAttempt() |
319 { | 319 { |
320 ASSERT(m_state == CONNECTING); | 320 ASSERT(m_state == CONNECTING); |
321 | 321 |
322 if (m_requestInFlight) { | 322 m_loader = nullptr; |
323 m_loader->cancel(); | 323 m_state = CLOSED; |
324 } else { | 324 networkRequestEnded(); |
325 m_state = CLOSED; | |
326 } | |
327 | 325 |
328 ASSERT(m_state == CLOSED); | |
329 dispatchEvent(Event::create(EventTypeNames::error)); | 326 dispatchEvent(Event::create(EventTypeNames::error)); |
330 } | 327 } |
331 | 328 |
332 void EventSource::parseEventStream() | 329 void EventSource::parseEventStream() |
333 { | 330 { |
334 unsigned bufPos = 0; | 331 unsigned bufPos = 0; |
335 unsigned bufSize = m_receiveBuf.size(); | 332 unsigned bufSize = m_receiveBuf.size(); |
336 while (bufPos < bufSize) { | 333 while (bufPos < bufSize) { |
337 if (m_discardTrailingNewline) { | 334 if (m_discardTrailingNewline) { |
338 if (m_receiveBuf[bufPos] == '\n') | 335 if (m_receiveBuf[bufPos] == '\n') |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 return event.release(); | 446 return event.release(); |
450 } | 447 } |
451 | 448 |
452 DEFINE_TRACE(EventSource) | 449 DEFINE_TRACE(EventSource) |
453 { | 450 { |
454 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); | 451 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); |
455 ActiveDOMObject::trace(visitor); | 452 ActiveDOMObject::trace(visitor); |
456 } | 453 } |
457 | 454 |
458 } // namespace blink | 455 } // namespace blink |
OLD | NEW |