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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "modules/serviceworkers/WaitUntilObserver.h" 57 #include "modules/serviceworkers/WaitUntilObserver.h"
58 #include "platform/RuntimeEnabledFeatures.h" 58 #include "platform/RuntimeEnabledFeatures.h"
59 #include "public/platform/modules/notifications/WebNotificationData.h" 59 #include "public/platform/modules/notifications/WebNotificationData.h"
60 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" 60 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h"
61 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" 61 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
62 #include "public/web/WebSerializedScriptValue.h" 62 #include "public/web/WebSerializedScriptValue.h"
63 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" 63 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
64 #include "web/WebEmbeddedWorkerImpl.h" 64 #include "web/WebEmbeddedWorkerImpl.h"
65 #include "wtf/Assertions.h" 65 #include "wtf/Assertions.h"
66 #include "wtf/Functional.h" 66 #include "wtf/Functional.h"
67 #include "wtf/PtrUtil.h" 67 #include "wtf/PassOwnPtr.h"
68 #include <memory> 68
69 #include <utility> 69 #include <utility>
70 70
71 namespace blink { 71 namespace blink {
72 72
73 ServiceWorkerGlobalScopeProxy* ServiceWorkerGlobalScopeProxy::create(WebEmbedded WorkerImpl& embeddedWorker, Document& document, WebServiceWorkerContextClient& c lient) 73 ServiceWorkerGlobalScopeProxy* ServiceWorkerGlobalScopeProxy::create(WebEmbedded WorkerImpl& embeddedWorker, Document& document, WebServiceWorkerContextClient& c lient)
74 { 74 {
75 return new ServiceWorkerGlobalScopeProxy(embeddedWorker, document, client); 75 return new ServiceWorkerGlobalScopeProxy(embeddedWorker, document, client);
76 } 76 }
77 77
78 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy() 78 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy()
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 workerGlobalScope()->dispatchExtendableEvent(event, observer); 117 workerGlobalScope()->dispatchExtendableEvent(event, observer);
118 } 118 }
119 119
120 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID, const WebString& message, const WebSecurityOrigin& sourceOrigin, const WebMessag ePortChannelArray& webChannels, std::unique_ptr<WebServiceWorker::Handle> handle ) 120 void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID, const WebString& message, const WebSecurityOrigin& sourceOrigin, const WebMessag ePortChannelArray& webChannels, std::unique_ptr<WebServiceWorker::Handle> handle )
121 { 121 {
122 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e); 122 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag e);
123 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop e, webChannels); 123 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop e, webChannels);
124 String origin; 124 String origin;
125 if (!sourceOrigin.isUnique()) 125 if (!sourceOrigin.isUnique())
126 origin = sourceOrigin.toString(); 126 origin = sourceOrigin.toString();
127 ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutio nContext(), wrapUnique(handle.release())); 127 ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->getExecutio nContext(), adoptPtr(handle.release()));
128 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Message, eventID); 128 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Message, eventID);
129 129
130 Event* event = ExtendableMessageEvent::create(value, origin, ports, source, observer); 130 Event* event = ExtendableMessageEvent::create(value, origin, ports, source, observer);
131 workerGlobalScope()->dispatchExtendableEvent(event, observer); 131 workerGlobalScope()->dispatchExtendableEvent(event, observer);
132 } 132 }
133 133
134 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest) 134 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest)
135 { 135 {
136 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe quest.requestContext()); 136 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe quest.requestContext());
137 Request* request = Request::create(workerGlobalScope()->scriptController()-> getScriptState(), webRequest); 137 Request* request = Request::create(workerGlobalScope()->scriptController()-> getScriptState(), webRequest);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 Event* event = SyncEvent::create(EventTypeNames::sync, tag, lastChance == Is LastChance, observer); 210 Event* event = SyncEvent::create(EventTypeNames::sync, tag, lastChance == Is LastChance, observer);
211 workerGlobalScope()->dispatchExtendableEvent(event, observer); 211 workerGlobalScope()->dispatchExtendableEvent(event, observer);
212 } 212 }
213 213
214 bool ServiceWorkerGlobalScopeProxy::hasFetchEventHandler() 214 bool ServiceWorkerGlobalScopeProxy::hasFetchEventHandler()
215 { 215 {
216 DCHECK(m_workerGlobalScope); 216 DCHECK(m_workerGlobalScope);
217 return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch); 217 return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch);
218 } 218 }
219 219
220 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location) 220 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, PassOwnPtr<SourceLocation> location)
221 { 221 {
222 client().reportException(errorMessage, location->lineNumber(), location->col umnNumber(), location->url()); 222 client().reportException(errorMessage, location->lineNumber(), location->col umnNumber(), location->url());
223 } 223 }
224 224
225 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(ConsoleMessage* console Message) 225 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(ConsoleMessage* console Message)
226 { 226 {
227 client().reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->location()->lineNumber(), consol eMessage->location()->url()); 227 client().reportConsoleMessage(consoleMessage->source(), consoleMessage->leve l(), consoleMessage->message(), consoleMessage->location()->lineNumber(), consol eMessage->location()->url());
228 } 228 }
229 229
230 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes sage) 230 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes sage)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return *m_document; 298 return *m_document;
299 } 299 }
300 300
301 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st 301 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st
302 { 302 {
303 DCHECK(m_workerGlobalScope); 303 DCHECK(m_workerGlobalScope);
304 return m_workerGlobalScope; 304 return m_workerGlobalScope;
305 } 305 }
306 306
307 } // namespace blink 307 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698