| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "core/inspector/ConsoleMessage.h" | 48 #include "core/inspector/ConsoleMessage.h" |
| 49 #include "core/inspector/InspectorInstrumentation.h" | 49 #include "core/inspector/InspectorInstrumentation.h" |
| 50 #include "core/loader/ThreadableLoader.h" | 50 #include "core/loader/ThreadableLoader.h" |
| 51 #include "core/page/EventSourceInit.h" | 51 #include "core/page/EventSourceInit.h" |
| 52 #include "platform/HTTPNames.h" | 52 #include "platform/HTTPNames.h" |
| 53 #include "platform/network/ResourceError.h" | 53 #include "platform/network/ResourceError.h" |
| 54 #include "platform/network/ResourceRequest.h" | 54 #include "platform/network/ResourceRequest.h" |
| 55 #include "platform/network/ResourceResponse.h" | 55 #include "platform/network/ResourceResponse.h" |
| 56 #include "platform/weborigin/SecurityOrigin.h" | 56 #include "platform/weborigin/SecurityOrigin.h" |
| 57 #include "public/platform/WebURLRequest.h" | 57 #include "public/platform/WebURLRequest.h" |
| 58 #include "wtf/ASCIICType.h" |
| 58 #include "wtf/text/StringBuilder.h" | 59 #include "wtf/text/StringBuilder.h" |
| 59 | 60 |
| 60 namespace blink { | 61 namespace blink { |
| 61 | 62 |
| 62 const unsigned long long EventSource::defaultReconnectDelay = 3000; | 63 const unsigned long long EventSource::defaultReconnectDelay = 3000; |
| 63 | 64 |
| 64 inline EventSource::EventSource(ExecutionContext* context, const KURL& url, cons
t EventSourceInit& eventSourceInit) | 65 inline EventSource::EventSource(ExecutionContext* context, const KURL& url, cons
t EventSourceInit& eventSourceInit) |
| 65 : ActiveDOMObject(context) | 66 : ActiveDOMObject(context) |
| 66 , m_url(url) | 67 , m_url(url) |
| 67 , m_withCredentials(eventSourceInit.withCredentials()) | 68 , m_withCredentials(eventSourceInit.withCredentials()) |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 402 |
| 402 if (field == "data") { | 403 if (field == "data") { |
| 403 if (valueLength) | 404 if (valueLength) |
| 404 m_data.append(&m_receiveBuf[bufPos], valueLength); | 405 m_data.append(&m_receiveBuf[bufPos], valueLength); |
| 405 m_data.append('\n'); | 406 m_data.append('\n'); |
| 406 } else if (field == "event") { | 407 } else if (field == "event") { |
| 407 m_eventName = valueLength ? AtomicString(&m_receiveBuf[bufPos], valu
eLength) : ""; | 408 m_eventName = valueLength ? AtomicString(&m_receiveBuf[bufPos], valu
eLength) : ""; |
| 408 } else if (field == "id") { | 409 } else if (field == "id") { |
| 409 m_currentlyParsedEventId = valueLength ? AtomicString(&m_receiveBuf[
bufPos], valueLength) : ""; | 410 m_currentlyParsedEventId = valueLength ? AtomicString(&m_receiveBuf[
bufPos], valueLength) : ""; |
| 410 } else if (field == "retry") { | 411 } else if (field == "retry") { |
| 412 bool hasOnlyDigits = true; |
| 413 for (int i = 0; i < valueLength && hasOnlyDigits; ++i) { |
| 414 hasOnlyDigits = isASCIIDigit(m_receiveBuf[bufPos + i]); |
| 415 } |
| 411 if (!valueLength) { | 416 if (!valueLength) { |
| 412 m_reconnectDelay = defaultReconnectDelay; | 417 m_reconnectDelay = defaultReconnectDelay; |
| 413 } else { | 418 } else if (hasOnlyDigits) { |
| 414 String value(&m_receiveBuf[bufPos], valueLength); | 419 String value(&m_receiveBuf[bufPos], valueLength); |
| 415 bool ok; | 420 bool ok; |
| 416 unsigned long long retry = value.toUInt64(&ok); | 421 unsigned long long retry = value.toUInt64(&ok); |
| 417 if (ok) | 422 if (ok) |
| 418 m_reconnectDelay = retry; | 423 m_reconnectDelay = retry; |
| 419 } | 424 } |
| 420 } | 425 } |
| 421 } | 426 } |
| 422 } | 427 } |
| 423 | 428 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 446 return event.release(); | 451 return event.release(); |
| 447 } | 452 } |
| 448 | 453 |
| 449 DEFINE_TRACE(EventSource) | 454 DEFINE_TRACE(EventSource) |
| 450 { | 455 { |
| 451 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); | 456 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); |
| 452 ActiveDOMObject::trace(visitor); | 457 ActiveDOMObject::trace(visitor); |
| 453 } | 458 } |
| 454 | 459 |
| 455 } // namespace blink | 460 } // namespace blink |
| OLD | NEW |