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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 // | 55 // |
56 // This implements WebServiceWorkerContextProxy, which connects ServiceWorker's | 56 // This implements WebServiceWorkerContextProxy, which connects ServiceWorker's |
57 // WorkerGlobalScope and embedder/chrome, and implements ServiceWorker-specific | 57 // WorkerGlobalScope and embedder/chrome, and implements ServiceWorker-specific |
58 // events/upcall methods that are to be called by embedder/chromium, | 58 // events/upcall methods that are to be called by embedder/chromium, |
59 // e.g. onfetch. | 59 // e.g. onfetch. |
60 // | 60 // |
61 // An instance of this class is supposed to outlive until | 61 // An instance of this class is supposed to outlive until |
62 // workerThreadTerminated() is called by its corresponding | 62 // workerThreadTerminated() is called by its corresponding |
63 // WorkerGlobalScope. | 63 // WorkerGlobalScope. |
64 class ServiceWorkerGlobalScopeProxy final | 64 class ServiceWorkerGlobalScopeProxy final |
65 : public WebServiceWorkerContextProxy | 65 : public NoBaseWillBeGarbageCollectedFinalized<ServiceWorkerGlobalScopeProxy > |
66 , public WebServiceWorkerContextProxy | |
66 , public WorkerReportingProxy { | 67 , public WorkerReportingProxy { |
67 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeProxy); | 68 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeProxy); |
68 USING_FAST_MALLOC(ServiceWorkerGlobalScopeProxy); | 69 USING_FAST_MALLOC_WILL_BE_REMOVED(ServiceWorkerGlobalScopeProxy); |
69 public: | 70 public: |
70 static PassOwnPtr<ServiceWorkerGlobalScopeProxy> create(WebEmbeddedWorkerImp l&, Document&, WebServiceWorkerContextClient&); | 71 static PassOwnPtrWillBeRawPtr<ServiceWorkerGlobalScopeProxy> create(WebEmbed dedWorkerImpl&, Document&, WebServiceWorkerContextClient&); |
71 ~ServiceWorkerGlobalScopeProxy() override; | 72 ~ServiceWorkerGlobalScopeProxy() override; |
72 | 73 |
73 // WebServiceWorkerContextProxy overrides: | 74 // WebServiceWorkerContextProxy overrides: |
74 void setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Handle>) ov erride; | 75 void setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Handle>) ov erride; |
75 void dispatchActivateEvent(int) override; | 76 void dispatchActivateEvent(int) override; |
76 void dispatchCrossOriginMessageEvent(const WebCrossOriginServiceWorkerClient &, const WebString& message, const WebMessagePortChannelArray&) override; | 77 void dispatchCrossOriginMessageEvent(const WebCrossOriginServiceWorkerClient &, const WebString& message, const WebMessagePortChannelArray&) override; |
77 void dispatchFetchEvent(int, const WebServiceWorkerRequest&) override; | 78 void dispatchFetchEvent(int, const WebServiceWorkerRequest&) override; |
78 void dispatchGeofencingEvent(int, WebGeofencingEventType, const WebString& r egionID, const WebCircularGeofencingRegion&) override; | 79 void dispatchGeofencingEvent(int, WebGeofencingEventType, const WebString& r egionID, const WebCircularGeofencingRegion&) override; |
79 void dispatchInstallEvent(int) override; | 80 void dispatchInstallEvent(int) override; |
80 void dispatchMessageEvent(const WebString& message, const WebMessagePortChan nelArray&) override; | 81 void dispatchMessageEvent(const WebString& message, const WebMessagePortChan nelArray&) override; |
81 void dispatchNotificationClickEvent(int, int64_t notificationID, const WebNo tificationData&, int actionIndex) override; | 82 void dispatchNotificationClickEvent(int, int64_t notificationID, const WebNo tificationData&, int actionIndex) override; |
82 void dispatchPushEvent(int, const WebString& data) override; | 83 void dispatchPushEvent(int, const WebString& data) override; |
83 void dispatchServicePortConnectEvent(WebServicePortConnectEventCallbacks*, c onst WebURL& targetURL, const WebString& origin, WebServicePortID) override; | 84 void dispatchServicePortConnectEvent(WebServicePortConnectEventCallbacks*, c onst WebURL& targetURL, const WebString& origin, WebServicePortID) override; |
84 void dispatchSyncEvent(int, const WebSyncRegistration&, LastChanceOption) ov erride; | 85 void dispatchSyncEvent(int, const WebSyncRegistration&, LastChanceOption) ov erride; |
85 | 86 |
86 // WorkerReportingProxy overrides: | 87 // WorkerReportingProxy overrides: |
87 void reportException(const String& errorMessage, int lineNumber, int columnN umber, const String& sourceURL, int exceptionId) override; | 88 void reportException(const String& errorMessage, int lineNumber, int columnN umber, const String& sourceURL, int exceptionId) override; |
88 void reportConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) override; | 89 void reportConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) override; |
89 void postMessageToPageInspector(const String&) override; | 90 void postMessageToPageInspector(const String&) override; |
90 void postWorkerConsoleAgentEnabled() override { } | 91 void postWorkerConsoleAgentEnabled() override { } |
91 void didEvaluateWorkerScript(bool success) override; | 92 void didEvaluateWorkerScript(bool success) override; |
92 void didInitializeWorkerContext() override; | 93 void didInitializeWorkerContext() override; |
93 void workerGlobalScopeStarted(WorkerGlobalScope*) override; | 94 void workerGlobalScopeStarted(WorkerGlobalScope*) override; |
94 void workerGlobalScopeClosed() override; | 95 void workerGlobalScopeClosed() override; |
95 void willDestroyWorkerGlobalScope() override; | 96 void willDestroyWorkerGlobalScope() override; |
96 void workerThreadTerminated() override; | 97 void workerThreadTerminated() override; |
97 | 98 |
99 DECLARE_TRACE(); | |
100 | |
98 private: | 101 private: |
99 ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerImpl&, Document&, WebServiceW orkerContextClient&); | 102 ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerImpl&, Document&, WebServiceW orkerContextClient&); |
100 | 103 |
101 WebEmbeddedWorkerImpl& m_embeddedWorker; | 104 WebEmbeddedWorkerImpl& m_embeddedWorker; |
haraken
2015/11/17 13:04:36
WebEmbeddedWorkerImpl is still off the heap. Doesn
sof
2015/11/17 13:43:04
This object would have to be used by a worker thre
| |
102 Document& m_document; | 105 RawPtrWillBeMember<Document> m_document; |
103 KURL m_documentURL; | 106 KURL m_documentURL; |
104 | 107 |
105 WebServiceWorkerContextClient& m_client; | 108 WebServiceWorkerContextClient& m_client; |
haraken
2015/11/17 13:04:36
Similarly, is this raw pointer safe?
| |
106 | 109 |
107 ServiceWorkerGlobalScope* m_workerGlobalScope; | 110 RawPtrWillBeMember<ServiceWorkerGlobalScope> m_workerGlobalScope; |
108 }; | 111 }; |
109 | 112 |
110 } // namespace blink | 113 } // namespace blink |
111 | 114 |
112 #endif // ServiceWorkerGlobalScopeProxy_h | 115 #endif // ServiceWorkerGlobalScopeProxy_h |
OLD | NEW |