Commit 3245542f authored by jsbell@chromium.org's avatar jsbell@chromium.org

ServiceWorker: Rename Client interface to ServiceWorkerClient

The interface was given a less generic name in a recent spec update:
https://github.com/slightlyoff/ServiceWorker/issues/350

BUG=403536
R=falken@chromium.org,haraken@chromium.org

Review URL: https://codereview.chromium.org/463423003

git-svn-id: svn://svn.chromium.org/blink/trunk@180291 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 373231e3
<!DOCTYPE html>
<title>Service Worker: postMessage to Client</title>
<title>Service Worker: postMessage to ServiceWorkerClient</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<script>
var t = async_test('postMessage MessagePorts from ServiceWorker to Client');
var t = async_test('postMessage MessagePorts from ServiceWorker to ServiceWorkerClient');
t.step(function() {
var scope = 'resources/blank.html'
service_worker_unregister_and_register(
......
<!DOCTYPE html>
<title>Service Worker: postMessage to Client</title>
<title>Service Worker: postMessage to ServiceWorkerClient</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<script>
var t = async_test('postMessage from ServiceWorker to Client');
var t = async_test('postMessage from ServiceWorker to ServiceWorkerClient');
t.step(function() {
var scope = 'resources/blank.html'
service_worker_unregister_and_register(
......
......@@ -22,7 +22,7 @@ test(function() {
getServiced: 'function'
});
verifyInterface('Client');
verifyInterface('ServiceWorkerClient');
// FIXME: Get an instance and test it, or ensure property exists on prototype.
}, 'Interfaces and attributes in ServiceWorkerGlobalScope');
......@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "config.h"
#include "bindings/modules/v8/V8Client.h"
#include "bindings/modules/v8/V8ServiceWorkerClient.h"
#include "bindings/core/v8/PostMessage.h"
#include "bindings/core/v8/V8Binding.h"
......@@ -11,9 +11,9 @@
namespace blink {
// FIXME: This stub should be replaced by generated code.
void V8Client::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
void V8ServiceWorkerClient::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
postMessageMethodCommon("Client", V8Client::toNative(info.Holder()), info);
postMessageMethodCommon("ServiceWorkerClient", V8ServiceWorkerClient::toNative(info.Holder()), info);
}
} // namespace blink
......@@ -6,7 +6,6 @@
bindings_modules_v8_custom_files = get_path_info(
[
"V8AudioNodeCustom.cpp",
"V8ClientCustom.cpp",
"V8CryptoCustom.cpp",
"V8CryptoKeyCustom.cpp",
"V8CustomSQLStatementErrorCallback.cpp",
......@@ -17,6 +16,7 @@ bindings_modules_v8_custom_files = get_path_info(
"V8SQLResultSetRowListCustom.cpp",
"V8SQLTransactionCustom.cpp",
"V8SQLTransactionSyncCustom.cpp",
"V8ServiceWorkerClientCustom.cpp",
"V8ServiceWorkerCustom.cpp",
"V8SubtleCryptoCustom.cpp",
],
......
......@@ -7,7 +7,6 @@
# Note: list duplicated in custom.gni.
'bindings_modules_v8_custom_files': [
'V8AudioNodeCustom.cpp',
'V8ClientCustom.cpp',
'V8CryptoCustom.cpp',
'V8CryptoKeyCustom.cpp',
'V8CustomSQLStatementErrorCallback.cpp',
......@@ -18,6 +17,7 @@
'V8SQLResultSetRowListCustom.cpp',
'V8SQLTransactionCustom.cpp',
'V8SQLTransactionSyncCustom.cpp',
'V8ServiceWorkerClientCustom.cpp',
'V8ServiceWorkerCustom.cpp',
'V8SubtleCryptoCustom.cpp',
],
......
......@@ -124,7 +124,6 @@
'screen_orientation/ScreenOrientation.idl',
'serviceworkers/Cache.idl',
'serviceworkers/CacheStorage.idl',
'serviceworkers/Client.idl',
'serviceworkers/FetchBodyStream.idl',
'serviceworkers/FetchEvent.idl',
'serviceworkers/Headers.idl',
......@@ -134,6 +133,7 @@
'serviceworkers/Request.idl',
'serviceworkers/Response.idl',
'serviceworkers/ServiceWorker.idl',
'serviceworkers/ServiceWorkerClient.idl',
'serviceworkers/ServiceWorkerClients.idl',
'serviceworkers/ServiceWorkerContainer.idl',
'serviceworkers/ServiceWorkerGlobalScope.idl',
......@@ -678,8 +678,6 @@
'serviceworkers/Cache.h',
'serviceworkers/CacheStorage.cpp',
'serviceworkers/CacheStorage.h',
'serviceworkers/Client.cpp',
'serviceworkers/Client.h',
'serviceworkers/FetchBodyStream.cpp',
'serviceworkers/FetchBodyStream.h',
'serviceworkers/FetchEvent.cpp',
......@@ -712,6 +710,8 @@
'serviceworkers/ResponseInit.h',
'serviceworkers/ServiceWorker.cpp',
'serviceworkers/ServiceWorker.h',
'serviceworkers/ServiceWorkerClient.cpp',
'serviceworkers/ServiceWorkerClient.h',
'serviceworkers/ServiceWorkerClients.cpp',
'serviceworkers/ServiceWorkerClients.h',
'serviceworkers/ServiceWorkerContainer.cpp',
......
......@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "config.h"
#include "modules/serviceworkers/Client.h"
#include "modules/serviceworkers/ServiceWorkerClient.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/SerializedScriptValue.h"
......@@ -13,20 +13,20 @@
namespace blink {
PassRefPtrWillBeRawPtr<Client> Client::create(unsigned id)
PassRefPtrWillBeRawPtr<ServiceWorkerClient> ServiceWorkerClient::create(unsigned id)
{
return adoptRefWillBeNoop(new Client(id));
return adoptRefWillBeNoop(new ServiceWorkerClient(id));
}
Client::Client(unsigned id)
ServiceWorkerClient::ServiceWorkerClient(unsigned id)
: m_id(id)
{
ScriptWrappable::init(this);
}
DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Client);
DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ServiceWorkerClient);
void Client::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState)
void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState)
{
// Disentangle the port in preparation for sending it to the remote context.
OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, exceptionState);
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef Client_h
#define Client_h
#ifndef ServiceWorkerClient_h
#define ServiceWorkerClient_h
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/SerializedScriptValue.h"
......@@ -12,23 +12,23 @@
namespace blink {
class Client FINAL : public RefCountedWillBeGarbageCollected<Client>, public ScriptWrappable {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Client);
class ServiceWorkerClient FINAL : public RefCountedWillBeGarbageCollected<ServiceWorkerClient>, public ScriptWrappable {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ServiceWorkerClient);
public:
static PassRefPtrWillBeRawPtr<Client> create(unsigned id);
static PassRefPtrWillBeRawPtr<ServiceWorkerClient> create(unsigned id);
// Client.idl
// ServiceWorkerClient.idl
unsigned id() const { return m_id; }
void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&);
void trace(Visitor*) { }
private:
explicit Client(unsigned id);
explicit ServiceWorkerClient(unsigned id);
unsigned m_id;
};
} // namespace blink
#endif // Client_h
#endif // ServiceWorkerClient_h
......@@ -2,16 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#client-interface
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-client-interface
[
Exposed=ServiceWorker,
RuntimeEnabled=ServiceWorker,
WillBeGarbageCollected,
] interface Client {
] interface ServiceWorkerClient {
readonly attribute unsigned long id;
// FIXME: Currently we think targetOrigin's probably not necessary, but
// re-add it if the ongoing issue [1] concludes the other way.
// [1] https://github.com/slightlyoff/ServiceWorker/issues/190
[Custom, RaisesException, CallWith=ExecutionContext] void postMessage(SerializedScriptValue message, optional sequence<Transferable> transfer);
};
......@@ -7,7 +7,7 @@
#include "bindings/core/v8/CallbackPromiseAdapter.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "modules/serviceworkers/Client.h"
#include "modules/serviceworkers/ServiceWorkerClient.h"
#include "modules/serviceworkers/ServiceWorkerError.h"
#include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
#include "public/platform/WebServiceWorkerClientsInfo.h"
......@@ -21,12 +21,12 @@ namespace {
class ClientArray {
public:
typedef blink::WebServiceWorkerClientsInfo WebType;
static WillBeHeapVector<RefPtrWillBeMember<Client> > take(ScriptPromiseResolver*, WebType* webClientsRaw)
static WillBeHeapVector<RefPtrWillBeMember<ServiceWorkerClient> > take(ScriptPromiseResolver*, WebType* webClientsRaw)
{
OwnPtr<WebType> webClients = adoptPtr(webClientsRaw);
WillBeHeapVector<RefPtrWillBeMember<Client> > clients;
WillBeHeapVector<RefPtrWillBeMember<ServiceWorkerClient> > clients;
for (size_t i = 0; i < webClients->clientIDs.size(); ++i) {
clients.append(Client::create(webClients->clientIDs[i]));
clients.append(ServiceWorkerClient::create(webClients->clientIDs[i]));
}
return clients;
}
......
......@@ -12,10 +12,10 @@
namespace blink {
class Client;
class ExecutionContext;
class ScriptState;
class ScriptPromise;
class ScriptState;
class ServiceWorkerClient;
class ServiceWorkerClients FINAL : public RefCountedWillBeGarbageCollected<ServiceWorkerClients>, public ScriptWrappable {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ServiceWorkerClients);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment