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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
index f3b58f8e0221fe0409d6cf6b37ba9b04de04fdc8..bb3e62cccc854f2bef266a58bdaf34753a186259 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorker.cpp
@@ -41,7 +41,6 @@
#include "public/platform/WebSecurityOrigin.h"
#include "public/platform/WebString.h"
#include "public/platform/modules/serviceworker/WebServiceWorkerState.h"
-#include <memory>
namespace blink {
@@ -59,7 +58,7 @@ void ServiceWorker::postMessage(ExecutionContext* context, PassRefPtr<Serialized
}
// Disentangle the port in preparation for sending it to the remote context.
- std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState);
+ OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState);
if (exceptionState.hadException())
return;
if (m_handle->serviceWorker()->state() == WebServiceWorkerStateRedundant) {
@@ -71,8 +70,8 @@ void ServiceWorker::postMessage(ExecutionContext* context, PassRefPtr<Serialized
context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "ServiceWorker cannot send an ArrayBuffer as a transferable object yet. See http://crbug.com/511119"));
WebString messageString = message->toWireString();
- std::unique_ptr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels));
- m_handle->serviceWorker()->postMessage(client->provider(), messageString, WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), webChannels.release());
+ OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(std::move(channels));
+ m_handle->serviceWorker()->postMessage(client->provider(), messageString, WebSecurityOrigin(getExecutionContext()->getSecurityOrigin()), webChannels.leakPtr());
}
void ServiceWorker::internalsTerminate()
@@ -113,7 +112,7 @@ String ServiceWorker::state() const
}
}
-ServiceWorker* ServiceWorker::from(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle)
+ServiceWorker* ServiceWorker::from(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle)
{
return getOrCreate(executionContext, std::move(handle));
}
@@ -130,7 +129,7 @@ void ServiceWorker::stop()
m_wasStopped = true;
}
-ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle)
+ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle)
{
if (!handle)
return nullptr;
@@ -146,7 +145,7 @@ ServiceWorker* ServiceWorker::getOrCreate(ExecutionContext* executionContext, st
return newWorker;
}
-ServiceWorker::ServiceWorker(ExecutionContext* executionContext, std::unique_ptr<WebServiceWorker::Handle> handle)
+ServiceWorker::ServiceWorker(ExecutionContext* executionContext, PassOwnPtr<WebServiceWorker::Handle> handle)
: AbstractWorker(executionContext)
, ActiveScriptWrappable(this)
, m_handle(std::move(handle))

Powered by Google App Engine
This is Rietveld 408576698