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