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

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

Issue 2649323005: Cleanly detach XHR and other pending loader clients from Inspector. (Closed)
Patch Set: clarifications Created 3 years, 10 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
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 source->scheduleInitialConnect(); 116 source->scheduleInitialConnect();
117 return source; 117 return source;
118 } 118 }
119 119
120 EventSource::~EventSource() { 120 EventSource::~EventSource() {
121 DCHECK_EQ(kClosed, m_state); 121 DCHECK_EQ(kClosed, m_state);
122 DCHECK(!m_loader); 122 DCHECK(!m_loader);
123 } 123 }
124 124
125 void EventSource::dispose() {
126 InspectorInstrumentation::detachClientRequest(getExecutionContext(), this);
127 }
128
125 void EventSource::scheduleInitialConnect() { 129 void EventSource::scheduleInitialConnect() {
126 DCHECK_EQ(kConnecting, m_state); 130 DCHECK_EQ(kConnecting, m_state);
127 DCHECK(!m_loader); 131 DCHECK(!m_loader);
128 132
129 m_connectTimer.startOneShot(0, BLINK_FROM_HERE); 133 m_connectTimer.startOneShot(0, BLINK_FROM_HERE);
130 } 134 }
131 135
132 void EventSource::connect() { 136 void EventSource::connect() {
133 DCHECK_EQ(kConnecting, m_state); 137 DCHECK_EQ(kConnecting, m_state);
134 DCHECK(!m_loader); 138 DCHECK(!m_loader);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void EventSource::abortConnectionAttempt() { 366 void EventSource::abortConnectionAttempt() {
363 DCHECK_EQ(kConnecting, m_state); 367 DCHECK_EQ(kConnecting, m_state);
364 368
365 m_loader = nullptr; 369 m_loader = nullptr;
366 m_state = kClosed; 370 m_state = kClosed;
367 networkRequestEnded(); 371 networkRequestEnded();
368 372
369 dispatchEvent(Event::create(EventTypeNames::error)); 373 dispatchEvent(Event::create(EventTypeNames::error));
370 } 374 }
371 375
372 void EventSource::contextDestroyed(ExecutionContext*) { 376 void EventSource::contextDestroyed(ExecutionContext*) {
yhirano 2017/01/27 08:58:44 InspectorInstrumentation::detachClientRequest(exec
sof 2017/01/27 09:09:40 The cancellation happening during close() ought to
373 close(); 377 close();
374 } 378 }
375 379
376 bool EventSource::hasPendingActivity() const { 380 bool EventSource::hasPendingActivity() const {
377 return m_state != kClosed; 381 return m_state != kClosed;
378 } 382 }
379 383
380 DEFINE_TRACE(EventSource) { 384 DEFINE_TRACE(EventSource) {
381 visitor->trace(m_parser); 385 visitor->trace(m_parser);
382 visitor->trace(m_loader); 386 visitor->trace(m_loader);
383 EventTargetWithInlineData::trace(visitor); 387 EventTargetWithInlineData::trace(visitor);
384 ContextLifecycleObserver::trace(visitor); 388 ContextLifecycleObserver::trace(visitor);
385 EventSourceParser::Client::trace(visitor); 389 EventSourceParser::Client::trace(visitor);
386 } 390 }
387 391
388 } // namespace blink 392 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/eventsource/EventSource.h ('k') | third_party/WebKit/Source/modules/fetch/FetchManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698