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

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

Issue 2727633006: DevTools: Rename InspectorInstrumentation:: namespace into probe:: (Closed)
Patch Set: Created 3 years, 9 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() { 125 void EventSource::dispose() {
126 InspectorInstrumentation::detachClientRequest(getExecutionContext(), this); 126 probe::detachClientRequest(getExecutionContext(), this);
127 } 127 }
128 128
129 void EventSource::scheduleInitialConnect() { 129 void EventSource::scheduleInitialConnect() {
130 DCHECK_EQ(kConnecting, m_state); 130 DCHECK_EQ(kConnecting, m_state);
131 DCHECK(!m_loader); 131 DCHECK(!m_loader);
132 132
133 m_connectTimer.startOneShot(0, BLINK_FROM_HERE); 133 m_connectTimer.startOneShot(0, BLINK_FROM_HERE);
134 } 134 }
135 135
136 void EventSource::connect() { 136 void EventSource::connect() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 resourceLoaderOptions.allowCredentials = 172 resourceLoaderOptions.allowCredentials =
173 (origin->canRequestNoSuborigin(m_currentURL) || m_withCredentials) 173 (origin->canRequestNoSuborigin(m_currentURL) || m_withCredentials)
174 ? AllowStoredCredentials 174 ? AllowStoredCredentials
175 : DoNotAllowStoredCredentials; 175 : DoNotAllowStoredCredentials;
176 resourceLoaderOptions.credentialsRequested = 176 resourceLoaderOptions.credentialsRequested =
177 m_withCredentials ? ClientRequestedCredentials 177 m_withCredentials ? ClientRequestedCredentials
178 : ClientDidNotRequestCredentials; 178 : ClientDidNotRequestCredentials;
179 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData; 179 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData;
180 resourceLoaderOptions.securityOrigin = origin; 180 resourceLoaderOptions.securityOrigin = origin;
181 181
182 InspectorInstrumentation::willSendEventSourceRequest(&executionContext, this); 182 probe::willSendEventSourceRequest(&executionContext, this);
183 // InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient 183 // probe::documentThreadableLoaderStartedLoadingForClient
184 // will be called synchronously. 184 // will be called synchronously.
185 m_loader = ThreadableLoader::create(executionContext, this, options, 185 m_loader = ThreadableLoader::create(executionContext, this, options,
186 resourceLoaderOptions); 186 resourceLoaderOptions);
187 m_loader->start(request); 187 m_loader->start(request);
188 } 188 }
189 189
190 void EventSource::networkRequestEnded() { 190 void EventSource::networkRequestEnded() {
191 InspectorInstrumentation::didFinishEventSourceRequest(getExecutionContext(), 191 probe::didFinishEventSourceRequest(getExecutionContext(), this);
192 this);
193 192
194 m_loader = nullptr; 193 m_loader = nullptr;
195 194
196 if (m_state != kClosed) 195 if (m_state != kClosed)
197 scheduleReconnect(); 196 scheduleReconnect();
198 } 197 }
199 198
200 void EventSource::scheduleReconnect() { 199 void EventSource::scheduleReconnect() {
201 m_state = kConnecting; 200 m_state = kConnecting;
202 m_connectTimer.startOneShot(m_reconnectDelay / 1000.0, BLINK_FROM_HERE); 201 m_connectTimer.startOneShot(m_reconnectDelay / 1000.0, BLINK_FROM_HERE);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 abortConnectionAttempt(); 345 abortConnectionAttempt();
347 } 346 }
348 347
349 void EventSource::onMessageEvent(const AtomicString& eventType, 348 void EventSource::onMessageEvent(const AtomicString& eventType,
350 const String& data, 349 const String& data,
351 const AtomicString& lastEventId) { 350 const AtomicString& lastEventId) {
352 MessageEvent* e = MessageEvent::create(); 351 MessageEvent* e = MessageEvent::create();
353 e->initMessageEvent(eventType, false, false, data, m_eventStreamOrigin, 352 e->initMessageEvent(eventType, false, false, data, m_eventStreamOrigin,
354 lastEventId, 0, nullptr); 353 lastEventId, 0, nullptr);
355 354
356 InspectorInstrumentation::willDispatchEventSourceEvent( 355 probe::willDispatchEventSourceEvent(getExecutionContext(), this, eventType,
357 getExecutionContext(), this, eventType, lastEventId, data); 356 lastEventId, data);
358 dispatchEvent(e); 357 dispatchEvent(e);
359 } 358 }
360 359
361 void EventSource::onReconnectionTimeSet(unsigned long long reconnectionTime) { 360 void EventSource::onReconnectionTimeSet(unsigned long long reconnectionTime) {
362 m_reconnectDelay = reconnectionTime; 361 m_reconnectDelay = reconnectionTime;
363 } 362 }
364 363
365 void EventSource::abortConnectionAttempt() { 364 void EventSource::abortConnectionAttempt() {
366 DCHECK_EQ(kConnecting, m_state); 365 DCHECK_EQ(kConnecting, m_state);
367 366
368 m_loader = nullptr; 367 m_loader = nullptr;
369 m_state = kClosed; 368 m_state = kClosed;
370 networkRequestEnded(); 369 networkRequestEnded();
371 370
372 dispatchEvent(Event::create(EventTypeNames::error)); 371 dispatchEvent(Event::create(EventTypeNames::error));
373 } 372 }
374 373
375 void EventSource::contextDestroyed(ExecutionContext*) { 374 void EventSource::contextDestroyed(ExecutionContext*) {
376 InspectorInstrumentation::detachClientRequest(getExecutionContext(), this); 375 probe::detachClientRequest(getExecutionContext(), this);
377 close(); 376 close();
378 } 377 }
379 378
380 bool EventSource::hasPendingActivity() const { 379 bool EventSource::hasPendingActivity() const {
381 return m_state != kClosed; 380 return m_state != kClosed;
382 } 381 }
383 382
384 DEFINE_TRACE(EventSource) { 383 DEFINE_TRACE(EventSource) {
385 visitor->trace(m_parser); 384 visitor->trace(m_parser);
386 visitor->trace(m_loader); 385 visitor->trace(m_loader);
387 EventTargetWithInlineData::trace(visitor); 386 EventTargetWithInlineData::trace(visitor);
388 ContextLifecycleObserver::trace(visitor); 387 ContextLifecycleObserver::trace(visitor);
389 EventSourceParser::Client::trace(visitor); 388 EventSourceParser::Client::trace(visitor);
390 } 389 }
391 390
392 } // namespace blink 391 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698