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> <!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/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script> <script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script> <script src="resources/test-helpers.js"></script>
<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() { t.step(function() {
var scope = 'resources/blank.html' var scope = 'resources/blank.html'
service_worker_unregister_and_register( service_worker_unregister_and_register(
......
<!DOCTYPE html> <!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/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script> <script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script> <script src="resources/test-helpers.js"></script>
<script> <script>
var t = async_test('postMessage from ServiceWorker to Client'); var t = async_test('postMessage from ServiceWorker to ServiceWorkerClient');
t.step(function() { t.step(function() {
var scope = 'resources/blank.html' var scope = 'resources/blank.html'
service_worker_unregister_and_register( service_worker_unregister_and_register(
......
...@@ -22,7 +22,7 @@ test(function() { ...@@ -22,7 +22,7 @@ test(function() {
getServiced: 'function' getServiced: 'function'
}); });
verifyInterface('Client'); verifyInterface('ServiceWorkerClient');
// FIXME: Get an instance and test it, or ensure property exists on prototype. // FIXME: Get an instance and test it, or ensure property exists on prototype.
}, 'Interfaces and attributes in ServiceWorkerGlobalScope'); }, 'Interfaces and attributes in ServiceWorkerGlobalScope');
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "config.h" #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/PostMessage.h"
#include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8Binding.h"
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
namespace blink { namespace blink {
// FIXME: This stub should be replaced by generated code. // 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 } // namespace blink
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
bindings_modules_v8_custom_files = get_path_info( bindings_modules_v8_custom_files = get_path_info(
[ [
"V8AudioNodeCustom.cpp", "V8AudioNodeCustom.cpp",
"V8ClientCustom.cpp",
"V8CryptoCustom.cpp", "V8CryptoCustom.cpp",
"V8CryptoKeyCustom.cpp", "V8CryptoKeyCustom.cpp",
"V8CustomSQLStatementErrorCallback.cpp", "V8CustomSQLStatementErrorCallback.cpp",
...@@ -17,6 +16,7 @@ bindings_modules_v8_custom_files = get_path_info( ...@@ -17,6 +16,7 @@ bindings_modules_v8_custom_files = get_path_info(
"V8SQLResultSetRowListCustom.cpp", "V8SQLResultSetRowListCustom.cpp",
"V8SQLTransactionCustom.cpp", "V8SQLTransactionCustom.cpp",
"V8SQLTransactionSyncCustom.cpp", "V8SQLTransactionSyncCustom.cpp",
"V8ServiceWorkerClientCustom.cpp",
"V8ServiceWorkerCustom.cpp", "V8ServiceWorkerCustom.cpp",
"V8SubtleCryptoCustom.cpp", "V8SubtleCryptoCustom.cpp",
], ],
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
# Note: list duplicated in custom.gni. # Note: list duplicated in custom.gni.
'bindings_modules_v8_custom_files': [ 'bindings_modules_v8_custom_files': [
'V8AudioNodeCustom.cpp', 'V8AudioNodeCustom.cpp',
'V8ClientCustom.cpp',
'V8CryptoCustom.cpp', 'V8CryptoCustom.cpp',
'V8CryptoKeyCustom.cpp', 'V8CryptoKeyCustom.cpp',
'V8CustomSQLStatementErrorCallback.cpp', 'V8CustomSQLStatementErrorCallback.cpp',
...@@ -18,6 +17,7 @@ ...@@ -18,6 +17,7 @@
'V8SQLResultSetRowListCustom.cpp', 'V8SQLResultSetRowListCustom.cpp',
'V8SQLTransactionCustom.cpp', 'V8SQLTransactionCustom.cpp',
'V8SQLTransactionSyncCustom.cpp', 'V8SQLTransactionSyncCustom.cpp',
'V8ServiceWorkerClientCustom.cpp',
'V8ServiceWorkerCustom.cpp', 'V8ServiceWorkerCustom.cpp',
'V8SubtleCryptoCustom.cpp', 'V8SubtleCryptoCustom.cpp',
], ],
......
...@@ -124,7 +124,6 @@ ...@@ -124,7 +124,6 @@
'screen_orientation/ScreenOrientation.idl', 'screen_orientation/ScreenOrientation.idl',
'serviceworkers/Cache.idl', 'serviceworkers/Cache.idl',
'serviceworkers/CacheStorage.idl', 'serviceworkers/CacheStorage.idl',
'serviceworkers/Client.idl',
'serviceworkers/FetchBodyStream.idl', 'serviceworkers/FetchBodyStream.idl',
'serviceworkers/FetchEvent.idl', 'serviceworkers/FetchEvent.idl',
'serviceworkers/Headers.idl', 'serviceworkers/Headers.idl',
...@@ -134,6 +133,7 @@ ...@@ -134,6 +133,7 @@
'serviceworkers/Request.idl', 'serviceworkers/Request.idl',
'serviceworkers/Response.idl', 'serviceworkers/Response.idl',
'serviceworkers/ServiceWorker.idl', 'serviceworkers/ServiceWorker.idl',
'serviceworkers/ServiceWorkerClient.idl',
'serviceworkers/ServiceWorkerClients.idl', 'serviceworkers/ServiceWorkerClients.idl',
'serviceworkers/ServiceWorkerContainer.idl', 'serviceworkers/ServiceWorkerContainer.idl',
'serviceworkers/ServiceWorkerGlobalScope.idl', 'serviceworkers/ServiceWorkerGlobalScope.idl',
...@@ -678,8 +678,6 @@ ...@@ -678,8 +678,6 @@
'serviceworkers/Cache.h', 'serviceworkers/Cache.h',
'serviceworkers/CacheStorage.cpp', 'serviceworkers/CacheStorage.cpp',
'serviceworkers/CacheStorage.h', 'serviceworkers/CacheStorage.h',
'serviceworkers/Client.cpp',
'serviceworkers/Client.h',
'serviceworkers/FetchBodyStream.cpp', 'serviceworkers/FetchBodyStream.cpp',
'serviceworkers/FetchBodyStream.h', 'serviceworkers/FetchBodyStream.h',
'serviceworkers/FetchEvent.cpp', 'serviceworkers/FetchEvent.cpp',
...@@ -712,6 +710,8 @@ ...@@ -712,6 +710,8 @@
'serviceworkers/ResponseInit.h', 'serviceworkers/ResponseInit.h',
'serviceworkers/ServiceWorker.cpp', 'serviceworkers/ServiceWorker.cpp',
'serviceworkers/ServiceWorker.h', 'serviceworkers/ServiceWorker.h',
'serviceworkers/ServiceWorkerClient.cpp',
'serviceworkers/ServiceWorkerClient.h',
'serviceworkers/ServiceWorkerClients.cpp', 'serviceworkers/ServiceWorkerClients.cpp',
'serviceworkers/ServiceWorkerClients.h', 'serviceworkers/ServiceWorkerClients.h',
'serviceworkers/ServiceWorkerContainer.cpp', 'serviceworkers/ServiceWorkerContainer.cpp',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "config.h" #include "config.h"
#include "modules/serviceworkers/Client.h" #include "modules/serviceworkers/ServiceWorkerClient.h"
#include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/SerializedScriptValue.h" #include "bindings/core/v8/SerializedScriptValue.h"
...@@ -13,20 +13,20 @@ ...@@ -13,20 +13,20 @@
namespace blink { 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) : m_id(id)
{ {
ScriptWrappable::init(this); 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. // Disentangle the port in preparation for sending it to the remote context.
OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, exceptionState); OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, exceptionState);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef Client_h #ifndef ServiceWorkerClient_h
#define Client_h #define ServiceWorkerClient_h
#include "bindings/core/v8/ScriptWrappable.h" #include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/SerializedScriptValue.h" #include "bindings/core/v8/SerializedScriptValue.h"
...@@ -12,23 +12,23 @@ ...@@ -12,23 +12,23 @@
namespace blink { namespace blink {
class Client FINAL : public RefCountedWillBeGarbageCollected<Client>, public ScriptWrappable { class ServiceWorkerClient FINAL : public RefCountedWillBeGarbageCollected<ServiceWorkerClient>, public ScriptWrappable {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Client); DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ServiceWorkerClient);
public: public:
static PassRefPtrWillBeRawPtr<Client> create(unsigned id); static PassRefPtrWillBeRawPtr<ServiceWorkerClient> create(unsigned id);
// Client.idl // ServiceWorkerClient.idl
unsigned id() const { return m_id; } unsigned id() const { return m_id; }
void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&); void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&);
void trace(Visitor*) { } void trace(Visitor*) { }
private: private:
explicit Client(unsigned id); explicit ServiceWorkerClient(unsigned id);
unsigned m_id; unsigned m_id;
}; };
} // namespace blink } // namespace blink
#endif // Client_h #endif // ServiceWorkerClient_h
...@@ -2,16 +2,13 @@ ...@@ -2,16 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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, Exposed=ServiceWorker,
RuntimeEnabled=ServiceWorker, RuntimeEnabled=ServiceWorker,
WillBeGarbageCollected, WillBeGarbageCollected,
] interface Client { ] interface ServiceWorkerClient {
readonly attribute unsigned long id; 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); [Custom, RaisesException, CallWith=ExecutionContext] void postMessage(SerializedScriptValue message, optional sequence<Transferable> transfer);
}; };
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "bindings/core/v8/CallbackPromiseAdapter.h" #include "bindings/core/v8/CallbackPromiseAdapter.h"
#include "bindings/core/v8/ScriptPromiseResolver.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/ServiceWorkerError.h"
#include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
#include "public/platform/WebServiceWorkerClientsInfo.h" #include "public/platform/WebServiceWorkerClientsInfo.h"
...@@ -21,12 +21,12 @@ namespace { ...@@ -21,12 +21,12 @@ namespace {
class ClientArray { class ClientArray {
public: public:
typedef blink::WebServiceWorkerClientsInfo WebType; 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); OwnPtr<WebType> webClients = adoptPtr(webClientsRaw);
WillBeHeapVector<RefPtrWillBeMember<Client> > clients; WillBeHeapVector<RefPtrWillBeMember<ServiceWorkerClient> > clients;
for (size_t i = 0; i < webClients->clientIDs.size(); ++i) { 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; return clients;
} }
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
namespace blink { namespace blink {
class Client;
class ExecutionContext; class ExecutionContext;
class ScriptState;
class ScriptPromise; class ScriptPromise;
class ScriptState;
class ServiceWorkerClient;
class ServiceWorkerClients FINAL : public RefCountedWillBeGarbageCollected<ServiceWorkerClients>, public ScriptWrappable { class ServiceWorkerClients FINAL : public RefCountedWillBeGarbageCollected<ServiceWorkerClients>, public ScriptWrappable {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ServiceWorkerClients); 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