| OLD | NEW |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // | 54 // |
| 55 // This implements WebServiceWorkerContextProxy, which connects ServiceWorker's | 55 // This implements WebServiceWorkerContextProxy, which connects ServiceWorker's |
| 56 // WorkerGlobalScope and embedder/chrome, and implements ServiceWorker-specific | 56 // WorkerGlobalScope and embedder/chrome, and implements ServiceWorker-specific |
| 57 // events/upcall methods that are to be called by embedder/chromium, | 57 // events/upcall methods that are to be called by embedder/chromium, |
| 58 // e.g. onfetch. | 58 // e.g. onfetch. |
| 59 // | 59 // |
| 60 // An instance of this class is supposed to outlive until | 60 // An instance of this class is supposed to outlive until |
| 61 // workerThreadTerminated() is called by its corresponding | 61 // workerThreadTerminated() is called by its corresponding |
| 62 // WorkerGlobalScope. | 62 // WorkerGlobalScope. |
| 63 class ServiceWorkerGlobalScopeProxy final | 63 class ServiceWorkerGlobalScopeProxy final |
| 64 : public NoBaseWillBeGarbageCollectedFinalized<ServiceWorkerGlobalScopeProxy
> | 64 : public GarbageCollectedFinalized<ServiceWorkerGlobalScopeProxy> |
| 65 , public WebServiceWorkerContextProxy | 65 , public WebServiceWorkerContextProxy |
| 66 , public WorkerReportingProxy { | 66 , public WorkerReportingProxy { |
| 67 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeProxy); | 67 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeProxy); |
| 68 USING_FAST_MALLOC_WILL_BE_REMOVED(ServiceWorkerGlobalScopeProxy); | |
| 69 public: | 68 public: |
| 70 static PassOwnPtrWillBeRawPtr<ServiceWorkerGlobalScopeProxy> create(WebEmbed
dedWorkerImpl&, Document&, WebServiceWorkerContextClient&); | 69 static RawPtr<ServiceWorkerGlobalScopeProxy> create(WebEmbeddedWorkerImpl&,
Document&, WebServiceWorkerContextClient&); |
| 71 ~ServiceWorkerGlobalScopeProxy() override; | 70 ~ServiceWorkerGlobalScopeProxy() override; |
| 72 | 71 |
| 73 // WebServiceWorkerContextProxy overrides: | 72 // WebServiceWorkerContextProxy overrides: |
| 74 void setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Handle>) ov
erride; | 73 void setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Handle>) ov
erride; |
| 75 void dispatchActivateEvent(int) override; | 74 void dispatchActivateEvent(int) override; |
| 76 void dispatchCrossOriginMessageEvent(const WebCrossOriginServiceWorkerClient
&, const WebString& message, const WebMessagePortChannelArray&) override; | 75 void dispatchCrossOriginMessageEvent(const WebCrossOriginServiceWorkerClient
&, const WebString& message, const WebMessagePortChannelArray&) override; |
| 77 void dispatchExtendableMessageEvent(int eventID, const WebString& message, c
onst WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&, const W
ebServiceWorkerClientInfo&) override; | 76 void dispatchExtendableMessageEvent(int eventID, const WebString& message, c
onst WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&, const W
ebServiceWorkerClientInfo&) override; |
| 78 void dispatchExtendableMessageEvent(int eventID, const WebString& message, c
onst WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&, WebPass
OwnPtr<WebServiceWorker::Handle>) override; | 77 void dispatchExtendableMessageEvent(int eventID, const WebString& message, c
onst WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&, WebPass
OwnPtr<WebServiceWorker::Handle>) override; |
| 79 void dispatchFetchEvent(int, const WebServiceWorkerRequest&) override; | 78 void dispatchFetchEvent(int, const WebServiceWorkerRequest&) override; |
| 80 void dispatchForeignFetchEvent(int, const WebServiceWorkerRequest&) override
; | 79 void dispatchForeignFetchEvent(int, const WebServiceWorkerRequest&) override
; |
| 81 void dispatchGeofencingEvent(int, WebGeofencingEventType, const WebString& r
egionID, const WebCircularGeofencingRegion&) override; | 80 void dispatchGeofencingEvent(int, WebGeofencingEventType, const WebString& r
egionID, const WebCircularGeofencingRegion&) override; |
| 82 void dispatchInstallEvent(int) override; | 81 void dispatchInstallEvent(int) override; |
| 83 void dispatchMessageEvent(const WebString& message, const WebMessagePortChan
nelArray&) override; | 82 void dispatchMessageEvent(const WebString& message, const WebMessagePortChan
nelArray&) override; |
| 84 void dispatchNotificationClickEvent(int, int64_t notificationID, const WebNo
tificationData&, int actionIndex) override; | 83 void dispatchNotificationClickEvent(int, int64_t notificationID, const WebNo
tificationData&, int actionIndex) override; |
| 85 void dispatchNotificationCloseEvent(int, int64_t notificationID, const WebNo
tificationData&) override; | 84 void dispatchNotificationCloseEvent(int, int64_t notificationID, const WebNo
tificationData&) override; |
| 86 void dispatchPushEvent(int, const WebString& data) override; | 85 void dispatchPushEvent(int, const WebString& data) override; |
| 87 void dispatchServicePortConnectEvent(WebServicePortConnectEventCallbacks*, c
onst WebURL& targetURL, const WebString& origin, WebServicePortID) override; | 86 void dispatchServicePortConnectEvent(WebServicePortConnectEventCallbacks*, c
onst WebURL& targetURL, const WebString& origin, WebServicePortID) override; |
| 88 void dispatchSyncEvent(int, const WebString& tag, LastChanceOption) override
; | 87 void dispatchSyncEvent(int, const WebString& tag, LastChanceOption) override
; |
| 89 | 88 |
| 90 // WorkerReportingProxy overrides: | 89 // WorkerReportingProxy overrides: |
| 91 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, int exceptionId) override; | 90 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, int exceptionId) override; |
| 92 void reportConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) override; | 91 void reportConsoleMessage(RawPtr<ConsoleMessage>) override; |
| 93 void postMessageToPageInspector(const String&) override; | 92 void postMessageToPageInspector(const String&) override; |
| 94 void postWorkerConsoleAgentEnabled() override { } | 93 void postWorkerConsoleAgentEnabled() override { } |
| 95 void didEvaluateWorkerScript(bool success) override; | 94 void didEvaluateWorkerScript(bool success) override; |
| 96 void didInitializeWorkerContext() override; | 95 void didInitializeWorkerContext() override; |
| 97 void workerGlobalScopeStarted(WorkerGlobalScope*) override; | 96 void workerGlobalScopeStarted(WorkerGlobalScope*) override; |
| 98 void workerGlobalScopeClosed() override; | 97 void workerGlobalScopeClosed() override; |
| 99 void willDestroyWorkerGlobalScope() override; | 98 void willDestroyWorkerGlobalScope() override; |
| 100 void workerThreadTerminated() override; | 99 void workerThreadTerminated() override; |
| 101 | 100 |
| 102 DECLARE_TRACE(); | 101 DECLARE_TRACE(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 | 112 |
| 114 WebServiceWorkerContextClient& client() const; | 113 WebServiceWorkerContextClient& client() const; |
| 115 Document& document() const; | 114 Document& document() const; |
| 116 ServiceWorkerGlobalScope* workerGlobalScope() const; | 115 ServiceWorkerGlobalScope* workerGlobalScope() const; |
| 117 | 116 |
| 118 void dispatchFetchEventImpl(int eventID, const WebServiceWorkerRequest&, con
st AtomicString& eventTypeName); | 117 void dispatchFetchEventImpl(int eventID, const WebServiceWorkerRequest&, con
st AtomicString& eventTypeName); |
| 119 | 118 |
| 120 // Non-null until the WebEmbeddedWorkerImpl explicitly detach()es | 119 // Non-null until the WebEmbeddedWorkerImpl explicitly detach()es |
| 121 // as part of its finalization. | 120 // as part of its finalization. |
| 122 WebEmbeddedWorkerImpl* m_embeddedWorker; | 121 WebEmbeddedWorkerImpl* m_embeddedWorker; |
| 123 RawPtrWillBeMember<Document> m_document; | 122 Member<Document> m_document; |
| 124 | 123 |
| 125 WebServiceWorkerContextClient* m_client; | 124 WebServiceWorkerContextClient* m_client; |
| 126 | 125 |
| 127 RawPtrWillBeMember<ServiceWorkerGlobalScope> m_workerGlobalScope; | 126 Member<ServiceWorkerGlobalScope> m_workerGlobalScope; |
| 128 }; | 127 }; |
| 129 | 128 |
| 130 } // namespace blink | 129 } // namespace blink |
| 131 | 130 |
| 132 #endif // ServiceWorkerGlobalScopeProxy_h | 131 #endif // ServiceWorkerGlobalScopeProxy_h |
| OLD | NEW |