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

Side by Side Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.h

Issue 2168513004: [DO NOT COMMIT] ServiceWorker: First touch of mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an unnecessary file Created 4 years, 4 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ServiceWorkerGlobalScopeClientImpl_h 31 #ifndef ServiceWorkerGlobalScopeClientImpl_h
32 #define ServiceWorkerGlobalScopeClientImpl_h 32 #define ServiceWorkerGlobalScopeClientImpl_h
33 33
34 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
34 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 35 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
36 #include "mojo/public/cpp/bindings/binding.h"
35 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" 37 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h"
36 #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallb acks.h" 38 #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallb acks.h"
39 #include "public/platform/modules/serviceworker/service_worker_global_scope.mojo m-blink.h"
40 #include "wtf/HashMap.h"
37 #include <memory> 41 #include <memory>
38 42
39 namespace blink { 43 namespace blink {
40 44
41 class WebServiceWorkerContextClient; 45 class WebServiceWorkerContextClient;
42 class WebServiceWorkerResponse; 46 class WebServiceWorkerResponse;
43 class WebURL; 47 class WebURL;
44 48
45 class ServiceWorkerGlobalScopeClientImpl final : public GarbageCollectedFinalize d<ServiceWorkerGlobalScopeClientImpl>, public ServiceWorkerGlobalScopeClient { 49 class ServiceWorkerGlobalScopeClientImpl final : public GarbageCollectedFinalize d<ServiceWorkerGlobalScopeClientImpl>, public ServiceWorkerGlobalScopeClient, pu blic mojom::blink::ServiceWorkerGlobalScopeClient {
46 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerGlobalScopeClientImpl); 50 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerGlobalScopeClientImpl);
51 USING_PRE_FINALIZER(ServiceWorkerGlobalScopeClientImpl, dispose);
47 public: 52 public:
48 static ServiceWorkerGlobalScopeClient* create(WebServiceWorkerContextClient& ); 53 static ::blink::ServiceWorkerGlobalScopeClient* create(WebServiceWorkerConte xtClient&);
49 ~ServiceWorkerGlobalScopeClientImpl() override; 54 ~ServiceWorkerGlobalScopeClientImpl() override;
50 55
56 void dispose();
57
51 void getClient(const WebString&, WebServiceWorkerClientCallbacks*) override; 58 void getClient(const WebString&, WebServiceWorkerClientCallbacks*) override;
52 void getClients(const WebServiceWorkerClientQueryOptions&, WebServiceWorkerC lientsCallbacks*) override; 59 void getClients(const WebServiceWorkerClientQueryOptions&, WebServiceWorkerC lientsCallbacks*) override;
53 void openWindow(const WebURL&, WebServiceWorkerClientCallbacks*) override; 60 void openWindow(const WebURL&, WebServiceWorkerClientCallbacks*) override;
54 void setCachedMetadata(const WebURL&, const char*, size_t) override; 61 void setCachedMetadata(const WebURL&, const char*, size_t) override;
55 void clearCachedMetadata(const WebURL&) override; 62 void clearCachedMetadata(const WebURL&) override;
56 63
57 WebURL scope() const override; 64 WebURL scope() const override;
58 65
66 void didInitializeContext(ServiceWorkerGlobalScope*) override;
59 void didHandleActivateEvent(int eventID, WebServiceWorkerEventResult) overri de; 67 void didHandleActivateEvent(int eventID, WebServiceWorkerEventResult) overri de;
60 void didHandleExtendableMessageEvent(int eventID, WebServiceWorkerEventResul t) override; 68 void didHandleExtendableMessageEvent(int eventID, WebServiceWorkerEventResul t) override;
61 void respondToFetchEvent(int responseID) override; 69 void respondToFetchEvent(int responseID) override;
62 void respondToFetchEvent(int responseID, const WebServiceWorkerResponse&) ov erride; 70 void respondToFetchEvent(int responseID, const WebServiceWorkerResponse&) ov erride;
63 void didHandleFetchEvent(int eventFinishID, WebServiceWorkerEventResult) ove rride; 71 void didHandleFetchEvent(int eventFinishID, WebServiceWorkerEventResult) ove rride;
64 void didHandleInstallEvent(int installEventID, WebServiceWorkerEventResult) override; 72 void didHandleInstallEvent(int installEventID, WebServiceWorkerEventResult) override;
65 void didHandleNotificationClickEvent(int eventID, WebServiceWorkerEventResul t) override; 73 void didHandleNotificationClickEvent(int eventID, WebServiceWorkerEventResul t) override;
66 void didHandleNotificationCloseEvent(int eventID, WebServiceWorkerEventResul t) override; 74 void didHandleNotificationCloseEvent(int eventID, WebServiceWorkerEventResul t) override;
67 void didHandlePushEvent(int pushEventID, WebServiceWorkerEventResult) overri de; 75 void didHandlePushEvent(int pushEventID, WebServiceWorkerEventResult) overri de;
68 void didHandleSyncEvent(int syncEventID, WebServiceWorkerEventResult) overri de; 76 void didHandleSyncEvent(int syncEventID, WebServiceWorkerEventResult) overri de;
69 void postMessageToClient(const WebString& clientUUID, const WebString& messa ge, std::unique_ptr<WebMessagePortChannelArray>) override; 77 void postMessageToClient(const WebString& clientUUID, const WebString& messa ge, std::unique_ptr<WebMessagePortChannelArray>) override;
70 void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient& , const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) overrid e; 78 void postMessageToCrossOriginClient(const WebCrossOriginServiceWorkerClient& , const WebString& message, std::unique_ptr<WebMessagePortChannelArray>) overrid e;
71 void skipWaiting(WebServiceWorkerSkipWaitingCallbacks*) override; 79 void skipWaiting(WebServiceWorkerSkipWaitingCallbacks*) override;
72 void claim(WebServiceWorkerClientsClaimCallbacks*) override; 80 void claim(WebServiceWorkerClientsClaimCallbacks*) override;
73 void focus(const WebString& clientUUID, WebServiceWorkerClientCallbacks*) ov erride; 81 void focus(const WebString& clientUUID, WebServiceWorkerClientCallbacks*) ov erride;
74 void navigate(const WebString& clientUUID, const WebURL&, WebServiceWorkerCl ientCallbacks*) override; 82 void navigate(const WebString& clientUUID, const WebURL&, WebServiceWorkerCl ientCallbacks*) override;
75 void registerForeignFetchScopes(const WebVector<WebURL>& subScopes, const We bVector<WebSecurityOrigin>&) override; 83 void registerForeignFetchScopes(const WebVector<WebURL>& subScopes, const We bVector<WebSecurityOrigin>&) override;
76 84
77 DEFINE_INLINE_VIRTUAL_TRACE() { ServiceWorkerGlobalScopeClient::trace(visito r); } 85 // mojom::blink::ServiceWorkerGlobalScopeClient implementation
86 void DispatchPingEvent(const WTF::String& message) override;
87 void DispatchFetchEvent(int requestID, int eventFinishID, mojom::blink::Serv iceWorkerFetchRequestPtr, const DispatchFetchEventCallback&) override;
88
89 DEFINE_INLINE_VIRTUAL_TRACE() {
90 visitor->trace(m_parent);
91 ::blink::ServiceWorkerGlobalScopeClient::trace(visitor);
92 }
78 93
79 private: 94 private:
80 explicit ServiceWorkerGlobalScopeClientImpl(WebServiceWorkerContextClient&); 95 explicit ServiceWorkerGlobalScopeClientImpl(WebServiceWorkerContextClient&);
96 // mojo
97 mojom::blink::ServiceWorkerGlobalScopeHostPtr& hostProcess();
98 ServiceWorkerGlobalScope* workerGlobalScope();
81 99
82 WebServiceWorkerContextClient& m_client; 100 WebServiceWorkerContextClient& m_client;
101 Member<ServiceWorkerGlobalScope> m_parent;
102
103 // mojo
104 std::unique_ptr<mojo::Binding<mojom::blink::ServiceWorkerGlobalScopeClient>> m_clientBinding;
105 mojom::blink::ServiceWorkerGlobalScopeHostPtr m_hostProcess;
106 WTF::HashMap<int32_t, mojom::blink::ServiceWorkerGlobalScopeClient::Dispatch FetchEventCallback> m_fetchCallbacks;
83 }; 107 };
84 108
85 } // namespace blink 109 } // namespace blink
86 110
87 #endif // ServiceWorkerGlobalScopeClientImpl_h 111 #endif // ServiceWorkerGlobalScopeClientImpl_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698