Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: third_party/WebKit/Source/modules/eventsource/EventSource.cpp

Issue 2641003004: Move EventSource timer to frame-specific TaskRunnerTimer. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/eventsource/EventSource.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 32
33 #include "modules/eventsource/EventSource.h" 33 #include "modules/eventsource/EventSource.h"
34 34
35 #include "bindings/core/v8/ExceptionState.h" 35 #include "bindings/core/v8/ExceptionState.h"
36 #include "bindings/core/v8/ScriptController.h" 36 #include "bindings/core/v8/ScriptController.h"
37 #include "bindings/core/v8/SerializedScriptValue.h" 37 #include "bindings/core/v8/SerializedScriptValue.h"
38 #include "bindings/core/v8/SerializedScriptValueFactory.h" 38 #include "bindings/core/v8/SerializedScriptValueFactory.h"
39 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
40 #include "core/dom/ExceptionCode.h" 40 #include "core/dom/ExceptionCode.h"
41 #include "core/dom/ExecutionContext.h" 41 #include "core/dom/ExecutionContext.h"
42 #include "core/dom/TaskRunnerHelper.h"
42 #include "core/events/Event.h" 43 #include "core/events/Event.h"
43 #include "core/events/MessageEvent.h" 44 #include "core/events/MessageEvent.h"
44 #include "core/frame/LocalDOMWindow.h" 45 #include "core/frame/LocalDOMWindow.h"
45 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
46 #include "core/frame/UseCounter.h" 47 #include "core/frame/UseCounter.h"
47 #include "core/frame/csp/ContentSecurityPolicy.h" 48 #include "core/frame/csp/ContentSecurityPolicy.h"
48 #include "core/inspector/ConsoleMessage.h" 49 #include "core/inspector/ConsoleMessage.h"
49 #include "core/inspector/InspectorInstrumentation.h" 50 #include "core/inspector/InspectorInstrumentation.h"
50 #include "core/loader/ThreadableLoader.h" 51 #include "core/loader/ThreadableLoader.h"
51 #include "modules/eventsource/EventSourceInit.h" 52 #include "modules/eventsource/EventSourceInit.h"
(...skipping 11 matching lines...) Expand all
63 const unsigned long long EventSource::defaultReconnectDelay = 3000; 64 const unsigned long long EventSource::defaultReconnectDelay = 3000;
64 65
65 inline EventSource::EventSource(ExecutionContext* context, 66 inline EventSource::EventSource(ExecutionContext* context,
66 const KURL& url, 67 const KURL& url,
67 const EventSourceInit& eventSourceInit) 68 const EventSourceInit& eventSourceInit)
68 : ContextLifecycleObserver(context), 69 : ContextLifecycleObserver(context),
69 m_url(url), 70 m_url(url),
70 m_currentURL(url), 71 m_currentURL(url),
71 m_withCredentials(eventSourceInit.withCredentials()), 72 m_withCredentials(eventSourceInit.withCredentials()),
72 m_state(kConnecting), 73 m_state(kConnecting),
73 m_connectTimer(this, &EventSource::connectTimerFired), 74 m_connectTimer(TaskRunnerHelper::get(TaskType::RemoteEvent, context),
75 this,
76 &EventSource::connectTimerFired),
74 m_reconnectDelay(defaultReconnectDelay) {} 77 m_reconnectDelay(defaultReconnectDelay) {}
75 78
76 EventSource* EventSource::create(ExecutionContext* context, 79 EventSource* EventSource::create(ExecutionContext* context,
77 const String& url, 80 const String& url,
78 const EventSourceInit& eventSourceInit, 81 const EventSourceInit& eventSourceInit,
79 ExceptionState& exceptionState) { 82 ExceptionState& exceptionState) {
80 if (context->isDocument()) 83 if (context->isDocument())
81 UseCounter::count(toDocument(context), UseCounter::EventSourceDocument); 84 UseCounter::count(toDocument(context), UseCounter::EventSourceDocument);
82 else 85 else
83 UseCounter::count(context, UseCounter::EventSourceWorker); 86 UseCounter::count(context, UseCounter::EventSourceWorker);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 382
380 DEFINE_TRACE(EventSource) { 383 DEFINE_TRACE(EventSource) {
381 visitor->trace(m_parser); 384 visitor->trace(m_parser);
382 visitor->trace(m_loader); 385 visitor->trace(m_loader);
383 EventTargetWithInlineData::trace(visitor); 386 EventTargetWithInlineData::trace(visitor);
384 ContextLifecycleObserver::trace(visitor); 387 ContextLifecycleObserver::trace(visitor);
385 EventSourceParser::Client::trace(visitor); 388 EventSourceParser::Client::trace(visitor);
386 } 389 }
387 390
388 } // namespace blink 391 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/eventsource/EventSource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698