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/InspectorInstrumentation.h" | 48 #include "core/inspector/InspectorInstrumentation.h" |
49 #include "core/loader/ThreadableLoader.h" | 49 #include "core/loader/ThreadableLoader.h" |
50 #include "core/page/EventSourceInit.h" | 50 #include "core/page/EventSourceInit.h" |
51 #include "platform/HTTPNames.h" | 51 #include "platform/HTTPNames.h" |
52 #include "platform/network/ResourceError.h" | 52 #include "platform/network/ResourceError.h" |
53 #include "platform/network/ResourceRequest.h" | 53 #include "platform/network/ResourceRequest.h" |
54 #include "platform/network/ResourceResponse.h" | 54 #include "platform/network/ResourceResponse.h" |
55 #include "platform/weborigin/SecurityOrigin.h" | 55 #include "platform/weborigin/SecurityOrigin.h" |
56 #include "public/platform/WebURLRequest.h" | 56 #include "public/platform/WebURLRequest.h" |
57 #include "wtf/text/StringBuilder.h" | 57 #include "wtf/text/StringBuilder.h" |
58 #include <memory> | |
59 | 58 |
60 namespace blink { | 59 namespace blink { |
61 | 60 |
62 const unsigned long long EventSource::defaultReconnectDelay = 3000; | 61 const unsigned long long EventSource::defaultReconnectDelay = 3000; |
63 | 62 |
64 inline EventSource::EventSource(ExecutionContext* context, const KURL& url, cons
t EventSourceInit& eventSourceInit) | 63 inline EventSource::EventSource(ExecutionContext* context, const KURL& url, cons
t EventSourceInit& eventSourceInit) |
65 : ActiveScriptWrappable(this) | 64 : ActiveScriptWrappable(this) |
66 , ActiveDOMObject(context) | 65 , ActiveDOMObject(context) |
67 , m_url(url) | 66 , m_url(url) |
68 , m_currentURL(url) | 67 , m_currentURL(url) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const AtomicString& EventSource::interfaceName() const | 214 const AtomicString& EventSource::interfaceName() const |
216 { | 215 { |
217 return EventTargetNames::EventSource; | 216 return EventTargetNames::EventSource; |
218 } | 217 } |
219 | 218 |
220 ExecutionContext* EventSource::getExecutionContext() const | 219 ExecutionContext* EventSource::getExecutionContext() const |
221 { | 220 { |
222 return ActiveDOMObject::getExecutionContext(); | 221 return ActiveDOMObject::getExecutionContext(); |
223 } | 222 } |
224 | 223 |
225 void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& resp
onse, std::unique_ptr<WebDataConsumerHandle> handle) | 224 void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& resp
onse, PassOwnPtr<WebDataConsumerHandle> handle) |
226 { | 225 { |
227 ASSERT_UNUSED(handle, !handle); | 226 ASSERT_UNUSED(handle, !handle); |
228 ASSERT(m_state == CONNECTING); | 227 ASSERT(m_state == CONNECTING); |
229 ASSERT(m_loader); | 228 ASSERT(m_loader); |
230 | 229 |
231 m_currentURL = response.url(); | 230 m_currentURL = response.url(); |
232 m_eventStreamOrigin = SecurityOrigin::create(response.url())->toString(); | 231 m_eventStreamOrigin = SecurityOrigin::create(response.url())->toString(); |
233 int statusCode = response.httpStatusCode(); | 232 int statusCode = response.httpStatusCode(); |
234 bool mimeTypeIsValid = response.mimeType() == "text/event-stream"; | 233 bool mimeTypeIsValid = response.mimeType() == "text/event-stream"; |
235 bool responseIsValid = statusCode == 200 && mimeTypeIsValid; | 234 bool responseIsValid = statusCode == 200 && mimeTypeIsValid; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 352 |
354 DEFINE_TRACE(EventSource) | 353 DEFINE_TRACE(EventSource) |
355 { | 354 { |
356 visitor->trace(m_parser); | 355 visitor->trace(m_parser); |
357 EventTargetWithInlineData::trace(visitor); | 356 EventTargetWithInlineData::trace(visitor); |
358 ActiveDOMObject::trace(visitor); | 357 ActiveDOMObject::trace(visitor); |
359 EventSourceParser::Client::trace(visitor); | 358 EventSourceParser::Client::trace(visitor); |
360 } | 359 } |
361 | 360 |
362 } // namespace blink | 361 } // namespace blink |
OLD | NEW |