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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.h

Issue 657213004: ServiceWorker: Issue a warning after initial execution of worker script (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporate reviews and rebase Created 6 years, 2 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class ServiceWorkerThread; 48 class ServiceWorkerThread;
49 class WorkerThreadStartupData; 49 class WorkerThreadStartupData;
50 50
51 class ServiceWorkerGlobalScope final : public WorkerGlobalScope { 51 class ServiceWorkerGlobalScope final : public WorkerGlobalScope {
52 DEFINE_WRAPPERTYPEINFO(); 52 DEFINE_WRAPPERTYPEINFO();
53 public: 53 public:
54 static PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> create(ServiceWorker Thread*, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>); 54 static PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> create(ServiceWorker Thread*, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData>);
55 55
56 virtual ~ServiceWorkerGlobalScope(); 56 virtual ~ServiceWorkerGlobalScope();
57 virtual bool isServiceWorkerGlobalScope() const override { return true; } 57 virtual bool isServiceWorkerGlobalScope() const override { return true; }
58
59 // WorkerGlobalScope
58 virtual void stopFetch() override; 60 virtual void stopFetch() override;
61 virtual void didEvaluateWorkerScript() override;
59 62
60 // ServiceWorkerGlobalScope.idl 63 // ServiceWorkerGlobalScope.idl
61 ServiceWorkerClients* clients(); 64 ServiceWorkerClients* clients();
62 String scope(ExecutionContext*); 65 String scope(ExecutionContext*);
63 66
64 CacheStorage* caches(ExecutionContext*); 67 CacheStorage* caches(ExecutionContext*);
65 68
66 ScriptPromise fetch(ScriptState*, Request*); 69 ScriptPromise fetch(ScriptState*, Request*);
67 ScriptPromise fetch(ScriptState*, Request*, const Dictionary&); 70 ScriptPromise fetch(ScriptState*, Request*, const Dictionary&);
68 ScriptPromise fetch(ScriptState*, const String&); 71 ScriptPromise fetch(ScriptState*, const String&);
69 ScriptPromise fetch(ScriptState*, const String&, const Dictionary&); 72 ScriptPromise fetch(ScriptState*, const String&, const Dictionary&);
70 73
71 void close(ExceptionState&); 74 void close(ExceptionState&);
72 75
73 // EventTarget 76 // EventTarget
77 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) override;
74 virtual const AtomicString& interfaceName() const override; 78 virtual const AtomicString& interfaceName() const override;
75 79
76 DEFINE_ATTRIBUTE_EVENT_LISTENER(install); 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(install);
77 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate);
78 DEFINE_ATTRIBUTE_EVENT_LISTENER(fetch); 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(fetch);
79 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
80 DEFINE_ATTRIBUTE_EVENT_LISTENER(sync); 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(sync);
81 85
82 virtual void trace(Visitor*) override; 86 virtual void trace(Visitor*) override;
83 87
84 private: 88 private:
85 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker Thread*, double timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<Worker Clients>); 89 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker Thread*, double timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<Worker Clients>);
86 virtual void importScripts(const Vector<String>& urls, ExceptionState&) over ride; 90 virtual void importScripts(const Vector<String>& urls, ExceptionState&) over ride;
87 virtual void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack>) override; 91 virtual void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack>) override;
88 92
89 PersistentWillBeMember<ServiceWorkerClients> m_clients; 93 PersistentWillBeMember<ServiceWorkerClients> m_clients;
90 OwnPtr<FetchManager> m_fetchManager; 94 OwnPtr<FetchManager> m_fetchManager;
91 PersistentWillBeMember<CacheStorage> m_caches; 95 PersistentWillBeMember<CacheStorage> m_caches;
96 bool m_didEvaluateScript;
92 }; 97 };
93 98
94 } // namespace blink 99 } // namespace blink
95 100
96 #endif // ServiceWorkerGlobalScope_h 101 #endif // ServiceWorkerGlobalScope_h
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerThread.cpp ('k') | Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698