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

Side by Side Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 2002883002: ServiceWorker: Store the existence of fetch event handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix my mistake Created 4 years, 7 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 { 203 {
204 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { 204 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) {
205 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync Event(eventID, WebServiceWorkerEventResultCompleted); 205 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync Event(eventID, WebServiceWorkerEventResultCompleted);
206 return; 206 return;
207 } 207 }
208 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Sync, eventID); 208 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Sync, eventID);
209 Event* event = SyncEvent::create(EventTypeNames::sync, tag, lastChance == Is LastChance, observer); 209 Event* event = SyncEvent::create(EventTypeNames::sync, tag, lastChance == Is LastChance, observer);
210 workerGlobalScope()->dispatchExtendableEvent(event, observer); 210 workerGlobalScope()->dispatchExtendableEvent(event, observer);
211 } 211 }
212 212
213 bool ServiceWorkerGlobalScopeProxy::hasFetchEventHandler()
214 {
215 DCHECK(m_workerGlobalScope);
216 return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch);
217 }
218
213 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, int) 219 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, int)
214 { 220 {
215 client().reportException(errorMessage, lineNumber, columnNumber, sourceURL); 221 client().reportException(errorMessage, lineNumber, columnNumber, sourceURL);
216 } 222 }
217 223
218 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(ConsoleMessage* console Message) 224 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(ConsoleMessage* console Message)
219 { 225 {
220 client().reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur l()); 226 client().reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur l());
221 } 227 }
222 228
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return *m_document; 297 return *m_document;
292 } 298 }
293 299
294 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st 300 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st
295 { 301 {
296 DCHECK(m_workerGlobalScope); 302 DCHECK(m_workerGlobalScope);
297 return m_workerGlobalScope; 303 return m_workerGlobalScope;
298 } 304 }
299 305
300 } // namespace blink 306 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698