OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/devtools/protocol/service_worker_handler.h" | 5 #include "content/browser/devtools/protocol/service_worker_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/public/browser/devtools_agent_host.h" | 26 #include "content/public/browser/devtools_agent_host.h" |
27 #include "content/public/browser/render_frame_host.h" | 27 #include "content/public/browser/render_frame_host.h" |
28 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
29 #include "content/public/browser/storage_partition.h" | 29 #include "content/public/browser/storage_partition.h" |
30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
31 #include "content/public/common/push_event_payload.h" | 31 #include "content/public/common/push_event_payload.h" |
32 #include "content/public/common/push_messaging_status.h" | 32 #include "content/public/common/push_messaging_status.h" |
33 #include "url/gurl.h" | 33 #include "url/gurl.h" |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 namespace devtools { | 36 namespace protocol { |
37 namespace service_worker { | |
38 | |
39 using Response = DevToolsProtocolClient::Response; | |
40 | 37 |
41 namespace { | 38 namespace { |
42 | 39 |
43 void ResultNoOp(bool success) { | 40 void ResultNoOp(bool success) { |
44 } | 41 } |
45 | 42 |
46 void StatusNoOp(ServiceWorkerStatusCode status) { | 43 void StatusNoOp(ServiceWorkerStatusCode status) { |
47 } | 44 } |
48 | 45 |
49 void StatusNoOpKeepingRegistration( | 46 void StatusNoOpKeepingRegistration( |
50 scoped_refptr<content::ServiceWorkerRegistration> protect, | 47 scoped_refptr<content::ServiceWorkerRegistration> protect, |
51 ServiceWorkerStatusCode status) { | 48 ServiceWorkerStatusCode status) { |
52 } | 49 } |
53 | 50 |
54 void PushDeliveryNoOp(PushDeliveryStatus status) { | 51 void PushDeliveryNoOp(PushDeliveryStatus status) { |
55 } | 52 } |
56 | 53 |
57 const std::string GetVersionRunningStatusString( | 54 const std::string GetVersionRunningStatusString( |
58 EmbeddedWorkerStatus running_status) { | 55 EmbeddedWorkerStatus running_status) { |
59 switch (running_status) { | 56 switch (running_status) { |
60 case EmbeddedWorkerStatus::STOPPED: | 57 case EmbeddedWorkerStatus::STOPPED: |
61 return kServiceWorkerVersionRunningStatusStopped; | 58 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Stopped; |
62 case EmbeddedWorkerStatus::STARTING: | 59 case EmbeddedWorkerStatus::STARTING: |
63 return kServiceWorkerVersionRunningStatusStarting; | 60 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Starting; |
64 case EmbeddedWorkerStatus::RUNNING: | 61 case EmbeddedWorkerStatus::RUNNING: |
65 return kServiceWorkerVersionRunningStatusRunning; | 62 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Running; |
66 case EmbeddedWorkerStatus::STOPPING: | 63 case EmbeddedWorkerStatus::STOPPING: |
67 return kServiceWorkerVersionRunningStatusStopping; | 64 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Stopping; |
| 65 default: |
| 66 NOTREACHED(); |
68 } | 67 } |
69 return std::string(); | 68 return std::string(); |
70 } | 69 } |
71 | 70 |
72 const std::string GetVersionStatusString( | 71 const std::string GetVersionStatusString( |
73 content::ServiceWorkerVersion::Status status) { | 72 content::ServiceWorkerVersion::Status status) { |
74 switch (status) { | 73 switch (status) { |
75 case content::ServiceWorkerVersion::NEW: | 74 case content::ServiceWorkerVersion::NEW: |
76 return kServiceWorkerVersionStatusNew; | 75 return ServiceWorker::ServiceWorkerVersionStatusEnum::New; |
77 case content::ServiceWorkerVersion::INSTALLING: | 76 case content::ServiceWorkerVersion::INSTALLING: |
78 return kServiceWorkerVersionStatusInstalling; | 77 return ServiceWorker::ServiceWorkerVersionStatusEnum::Installing; |
79 case content::ServiceWorkerVersion::INSTALLED: | 78 case content::ServiceWorkerVersion::INSTALLED: |
80 return kServiceWorkerVersionStatusInstalled; | 79 return ServiceWorker::ServiceWorkerVersionStatusEnum::Installed; |
81 case content::ServiceWorkerVersion::ACTIVATING: | 80 case content::ServiceWorkerVersion::ACTIVATING: |
82 return kServiceWorkerVersionStatusActivating; | 81 return ServiceWorker::ServiceWorkerVersionStatusEnum::Activating; |
83 case content::ServiceWorkerVersion::ACTIVATED: | 82 case content::ServiceWorkerVersion::ACTIVATED: |
84 return kServiceWorkerVersionStatusActivated; | 83 return ServiceWorker::ServiceWorkerVersionStatusEnum::Activated; |
85 case content::ServiceWorkerVersion::REDUNDANT: | 84 case content::ServiceWorkerVersion::REDUNDANT: |
86 return kServiceWorkerVersionStatusRedundant; | 85 return ServiceWorker::ServiceWorkerVersionStatusEnum::Redundant; |
| 86 default: |
| 87 NOTREACHED(); |
87 } | 88 } |
88 return std::string(); | 89 return std::string(); |
89 } | 90 } |
90 | 91 |
91 scoped_refptr<ServiceWorkerVersion> CreateVersionDictionaryValue( | |
92 const ServiceWorkerVersionInfo& version_info) { | |
93 std::vector<std::string> clients; | |
94 for (const auto& client : version_info.clients) { | |
95 if (client.second.type == SERVICE_WORKER_PROVIDER_FOR_WINDOW) { | |
96 RenderFrameHostImpl* render_frame_host = RenderFrameHostImpl::FromID( | |
97 client.second.process_id, client.second.route_id); | |
98 WebContents* web_contents = | |
99 WebContents::FromRenderFrameHost(render_frame_host); | |
100 // There is a possibility that the frame is already deleted because of the | |
101 // thread hopping. | |
102 if (!web_contents) | |
103 continue; | |
104 scoped_refptr<DevToolsAgentHost> agent_host( | |
105 DevToolsAgentHost::GetOrCreateFor(web_contents)); | |
106 if (agent_host) | |
107 clients.push_back(agent_host->GetId()); | |
108 } else if (client.second.type == | |
109 SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER) { | |
110 scoped_refptr<DevToolsAgentHost> agent_host( | |
111 DevToolsAgentHost::GetForWorker(client.second.process_id, | |
112 client.second.route_id)); | |
113 if (agent_host) | |
114 clients.push_back(agent_host->GetId()); | |
115 } | |
116 } | |
117 scoped_refptr<ServiceWorkerVersion> version( | |
118 ServiceWorkerVersion::Create() | |
119 ->set_version_id(base::Int64ToString(version_info.version_id)) | |
120 ->set_registration_id( | |
121 base::Int64ToString(version_info.registration_id)) | |
122 ->set_script_url(version_info.script_url.spec()) | |
123 ->set_running_status( | |
124 GetVersionRunningStatusString(version_info.running_status)) | |
125 ->set_status(GetVersionStatusString(version_info.status)) | |
126 ->set_script_last_modified( | |
127 version_info.script_last_modified.ToDoubleT()) | |
128 ->set_script_response_time( | |
129 version_info.script_response_time.ToDoubleT()) | |
130 ->set_controlled_clients(clients)); | |
131 scoped_refptr<DevToolsAgentHostImpl> host( | |
132 ServiceWorkerDevToolsManager::GetInstance() | |
133 ->GetDevToolsAgentHostForWorker( | |
134 version_info.process_id, | |
135 version_info.devtools_agent_route_id)); | |
136 if (host) | |
137 version->set_target_id(host->GetId()); | |
138 return version; | |
139 } | |
140 | |
141 scoped_refptr<ServiceWorkerRegistration> CreateRegistrationDictionaryValue( | |
142 const ServiceWorkerRegistrationInfo& registration_info) { | |
143 scoped_refptr<ServiceWorkerRegistration> registration( | |
144 ServiceWorkerRegistration::Create() | |
145 ->set_registration_id( | |
146 base::Int64ToString(registration_info.registration_id)) | |
147 ->set_scope_url(registration_info.pattern.spec()) | |
148 ->set_is_deleted(registration_info.delete_flag == | |
149 ServiceWorkerRegistrationInfo::IS_DELETED)); | |
150 return registration; | |
151 } | |
152 | |
153 void StopServiceWorkerOnIO(scoped_refptr<ServiceWorkerContextWrapper> context, | 92 void StopServiceWorkerOnIO(scoped_refptr<ServiceWorkerContextWrapper> context, |
154 int64_t version_id) { | 93 int64_t version_id) { |
155 if (content::ServiceWorkerVersion* version = | 94 if (content::ServiceWorkerVersion* version = |
156 context->GetLiveVersion(version_id)) { | 95 context->GetLiveVersion(version_id)) { |
157 version->StopWorker(base::Bind(&StatusNoOp)); | 96 version->StopWorker(base::Bind(&StatusNoOp)); |
158 } | 97 } |
159 } | 98 } |
160 | 99 |
161 void GetDevToolsRouteInfoOnIO( | 100 void GetDevToolsRouteInfoOnIO( |
162 scoped_refptr<ServiceWorkerContextWrapper> context, | 101 scoped_refptr<ServiceWorkerContextWrapper> context, |
163 int64_t version_id, | 102 int64_t version_id, |
164 const base::Callback<void(int, int)>& callback) { | 103 const base::Callback<void(int, int)>& callback) { |
165 if (content::ServiceWorkerVersion* version = | 104 if (content::ServiceWorkerVersion* version = |
166 context->GetLiveVersion(version_id)) { | 105 context->GetLiveVersion(version_id)) { |
167 BrowserThread::PostTask( | 106 BrowserThread::PostTask( |
168 BrowserThread::UI, FROM_HERE, | 107 BrowserThread::UI, FROM_HERE, |
169 base::Bind( | 108 base::Bind( |
170 callback, version->embedded_worker()->process_id(), | 109 callback, version->embedded_worker()->process_id(), |
171 version->embedded_worker()->worker_devtools_agent_route_id())); | 110 version->embedded_worker()->worker_devtools_agent_route_id())); |
172 } | 111 } |
173 } | 112 } |
174 | 113 |
175 Response CreateContextErrorResponse() { | 114 Response CreateContextErrorResponse() { |
176 return Response::InternalError("Could not connect to the context"); | 115 return Response::Error("Could not connect to the context"); |
177 } | 116 } |
178 | 117 |
179 Response CreateInvalidVersionIdErrorResponse() { | 118 Response CreateInvalidVersionIdErrorResponse() { |
180 return Response::InternalError("Invalid version ID"); | 119 return Response::InvalidParams("Invalid version ID"); |
181 } | 120 } |
182 | 121 |
183 void DidFindRegistrationForDispatchSyncEventOnIO( | 122 void DidFindRegistrationForDispatchSyncEventOnIO( |
184 scoped_refptr<BackgroundSyncContext> sync_context, | 123 scoped_refptr<BackgroundSyncContext> sync_context, |
185 const std::string& tag, | 124 const std::string& tag, |
186 bool last_chance, | 125 bool last_chance, |
187 ServiceWorkerStatusCode status, | 126 ServiceWorkerStatusCode status, |
188 scoped_refptr<content::ServiceWorkerRegistration> registration) { | 127 scoped_refptr<content::ServiceWorkerRegistration> registration) { |
189 if (status != SERVICE_WORKER_OK || !registration->active_version()) | 128 if (status != SERVICE_WORKER_OK || !registration->active_version()) |
190 return; | 129 return; |
(...skipping 19 matching lines...) Expand all Loading... |
210 tag, last_chance)); | 149 tag, last_chance)); |
211 } | 150 } |
212 | 151 |
213 } // namespace | 152 } // namespace |
214 | 153 |
215 ServiceWorkerHandler::ServiceWorkerHandler() | 154 ServiceWorkerHandler::ServiceWorkerHandler() |
216 : enabled_(false), render_frame_host_(nullptr), weak_factory_(this) { | 155 : enabled_(false), render_frame_host_(nullptr), weak_factory_(this) { |
217 } | 156 } |
218 | 157 |
219 ServiceWorkerHandler::~ServiceWorkerHandler() { | 158 ServiceWorkerHandler::~ServiceWorkerHandler() { |
220 Disable(); | 159 } |
| 160 |
| 161 void ServiceWorkerHandler::Wire(UberDispatcher* dispatcher) { |
| 162 frontend_.reset(new ServiceWorker::Frontend(dispatcher->channel())); |
| 163 ServiceWorker::Dispatcher::wire(dispatcher, this); |
221 } | 164 } |
222 | 165 |
223 void ServiceWorkerHandler::SetRenderFrameHost( | 166 void ServiceWorkerHandler::SetRenderFrameHost( |
224 RenderFrameHostImpl* render_frame_host) { | 167 RenderFrameHostImpl* render_frame_host) { |
225 render_frame_host_ = render_frame_host; | 168 render_frame_host_ = render_frame_host; |
226 // Do not call UpdateHosts yet, wait for load to commit. | 169 // Do not call UpdateHosts yet, wait for load to commit. |
227 if (!render_frame_host) { | 170 if (!render_frame_host) { |
228 ClearForceUpdate(); | 171 ClearForceUpdate(); |
229 context_ = nullptr; | 172 context_ = nullptr; |
230 return; | 173 return; |
231 } | 174 } |
232 StoragePartition* partition = BrowserContext::GetStoragePartition( | 175 StoragePartition* partition = BrowserContext::GetStoragePartition( |
233 render_frame_host->GetProcess()->GetBrowserContext(), | 176 render_frame_host->GetProcess()->GetBrowserContext(), |
234 render_frame_host->GetSiteInstance()); | 177 render_frame_host->GetSiteInstance()); |
235 DCHECK(partition); | 178 DCHECK(partition); |
236 context_ = static_cast<ServiceWorkerContextWrapper*>( | 179 context_ = static_cast<ServiceWorkerContextWrapper*>( |
237 partition->GetServiceWorkerContext()); | 180 partition->GetServiceWorkerContext()); |
238 } | 181 } |
239 | 182 |
240 void ServiceWorkerHandler::SetClient(std::unique_ptr<Client> client) { | |
241 client_.swap(client); | |
242 } | |
243 | |
244 void ServiceWorkerHandler::Detached() { | |
245 Disable(); | |
246 } | |
247 | |
248 Response ServiceWorkerHandler::Enable() { | 183 Response ServiceWorkerHandler::Enable() { |
249 if (enabled_) | 184 if (enabled_) |
250 return Response::OK(); | 185 return Response::OK(); |
251 if (!context_) | 186 if (!context_) |
252 return Response::InternalError("Could not connect to the context"); | 187 return CreateContextErrorResponse(); |
253 enabled_ = true; | 188 enabled_ = true; |
254 | 189 |
255 context_watcher_ = new ServiceWorkerContextWatcher( | 190 context_watcher_ = new ServiceWorkerContextWatcher( |
256 context_, base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, | 191 context_, base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, |
257 weak_factory_.GetWeakPtr()), | 192 weak_factory_.GetWeakPtr()), |
258 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, | 193 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, |
259 weak_factory_.GetWeakPtr()), | 194 weak_factory_.GetWeakPtr()), |
260 base::Bind(&ServiceWorkerHandler::OnErrorReported, | 195 base::Bind(&ServiceWorkerHandler::OnErrorReported, |
261 weak_factory_.GetWeakPtr())); | 196 weak_factory_.GetWeakPtr())); |
262 context_watcher_->Start(); | 197 context_watcher_->Start(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 scoped_refptr<DevToolsAgentHostImpl> agent_host( | 337 scoped_refptr<DevToolsAgentHostImpl> agent_host( |
403 ServiceWorkerDevToolsManager::GetInstance() | 338 ServiceWorkerDevToolsManager::GetInstance() |
404 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); | 339 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); |
405 if (!agent_host.get()) | 340 if (!agent_host.get()) |
406 return; | 341 return; |
407 agent_host->Inspect(); | 342 agent_host->Inspect(); |
408 } | 343 } |
409 | 344 |
410 void ServiceWorkerHandler::OnWorkerRegistrationUpdated( | 345 void ServiceWorkerHandler::OnWorkerRegistrationUpdated( |
411 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { | 346 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { |
412 std::vector<scoped_refptr<ServiceWorkerRegistration>> registration_values; | 347 using Registration = ServiceWorker::ServiceWorkerRegistration; |
| 348 std::unique_ptr<protocol::Array<Registration>> result = |
| 349 protocol::Array<Registration>::create(); |
413 for (const auto& registration : registrations) { | 350 for (const auto& registration : registrations) { |
414 registration_values.push_back( | 351 result->addItem(Registration::Create() |
415 CreateRegistrationDictionaryValue(registration)); | 352 .SetRegistrationId( |
| 353 base::Int64ToString(registration.registration_id)) |
| 354 .SetScopeURL(registration.pattern.spec()) |
| 355 .SetIsDeleted(registration.delete_flag == |
| 356 ServiceWorkerRegistrationInfo::IS_DELETED) |
| 357 .Build()); |
416 } | 358 } |
417 client_->WorkerRegistrationUpdated( | 359 frontend_->WorkerRegistrationUpdated(std::move(result)); |
418 WorkerRegistrationUpdatedParams::Create()->set_registrations( | |
419 registration_values)); | |
420 } | 360 } |
421 | 361 |
422 void ServiceWorkerHandler::OnWorkerVersionUpdated( | 362 void ServiceWorkerHandler::OnWorkerVersionUpdated( |
423 const std::vector<ServiceWorkerVersionInfo>& versions) { | 363 const std::vector<ServiceWorkerVersionInfo>& versions) { |
424 std::vector<scoped_refptr<ServiceWorkerVersion>> version_values; | 364 using Version = ServiceWorker::ServiceWorkerVersion; |
| 365 std::unique_ptr<protocol::Array<Version>> result = |
| 366 protocol::Array<Version>::create(); |
425 for (const auto& version : versions) { | 367 for (const auto& version : versions) { |
426 version_values.push_back(CreateVersionDictionaryValue(version)); | 368 std::unique_ptr<protocol::Array<std::string>> clients = |
| 369 protocol::Array<std::string>::create(); |
| 370 for (const auto& client : version.clients) { |
| 371 if (client.second.type == SERVICE_WORKER_PROVIDER_FOR_WINDOW) { |
| 372 RenderFrameHostImpl* render_frame_host = RenderFrameHostImpl::FromID( |
| 373 client.second.process_id, client.second.route_id); |
| 374 WebContents* web_contents = |
| 375 WebContents::FromRenderFrameHost(render_frame_host); |
| 376 // There is a possibility that the frame is already deleted |
| 377 // because of the thread hopping. |
| 378 if (!web_contents) |
| 379 continue; |
| 380 clients->addItem( |
| 381 DevToolsAgentHost::GetOrCreateFor(web_contents)->GetId()); |
| 382 } else if (client.second.type == |
| 383 SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER) { |
| 384 scoped_refptr<DevToolsAgentHost> agent_host( |
| 385 DevToolsAgentHost::GetForWorker(client.second.process_id, |
| 386 client.second.route_id)); |
| 387 if (agent_host) |
| 388 clients->addItem(agent_host->GetId()); |
| 389 } |
| 390 } |
| 391 std::unique_ptr<Version> version_value = Version::Create() |
| 392 .SetVersionId(base::Int64ToString(version.version_id)) |
| 393 .SetRegistrationId( |
| 394 base::Int64ToString(version.registration_id)) |
| 395 .SetScriptURL(version.script_url.spec()) |
| 396 .SetRunningStatus( |
| 397 GetVersionRunningStatusString(version.running_status)) |
| 398 .SetStatus(GetVersionStatusString(version.status)) |
| 399 .SetScriptLastModified( |
| 400 version.script_last_modified.ToDoubleT()) |
| 401 .SetScriptResponseTime( |
| 402 version.script_response_time.ToDoubleT()) |
| 403 .SetControlledClients(std::move(clients)) |
| 404 .Build(); |
| 405 scoped_refptr<DevToolsAgentHostImpl> host( |
| 406 ServiceWorkerDevToolsManager::GetInstance() |
| 407 ->GetDevToolsAgentHostForWorker( |
| 408 version.process_id, |
| 409 version.devtools_agent_route_id)); |
| 410 if (host) |
| 411 version_value->SetTargetId(host->GetId()); |
| 412 result->addItem(std::move(version_value)); |
427 } | 413 } |
428 client_->WorkerVersionUpdated( | 414 frontend_->WorkerVersionUpdated(std::move(result)); |
429 WorkerVersionUpdatedParams::Create()->set_versions(version_values)); | |
430 } | 415 } |
431 | 416 |
432 void ServiceWorkerHandler::OnErrorReported( | 417 void ServiceWorkerHandler::OnErrorReported( |
433 int64_t registration_id, | 418 int64_t registration_id, |
434 int64_t version_id, | 419 int64_t version_id, |
435 const ServiceWorkerContextObserver::ErrorInfo& info) { | 420 const ServiceWorkerContextObserver::ErrorInfo& info) { |
436 client_->WorkerErrorReported( | 421 frontend_->WorkerErrorReported( |
437 WorkerErrorReportedParams::Create()->set_error_message( | 422 ServiceWorker::ServiceWorkerErrorMessage::Create() |
438 ServiceWorkerErrorMessage::Create() | 423 .SetErrorMessage(base::UTF16ToUTF8(info.error_message)) |
439 ->set_error_message(base::UTF16ToUTF8(info.error_message)) | 424 .SetRegistrationId(base::Int64ToString(registration_id)) |
440 ->set_registration_id(base::Int64ToString(registration_id)) | 425 .SetVersionId(base::Int64ToString(version_id)) |
441 ->set_version_id(base::Int64ToString(version_id)) | 426 .SetSourceURL(info.source_url.spec()) |
442 ->set_source_url(info.source_url.spec()) | 427 .SetLineNumber(info.line_number) |
443 ->set_line_number(info.line_number) | 428 .SetColumnNumber(info.column_number) |
444 ->set_column_number(info.column_number))); | 429 .Build()); |
445 } | 430 } |
446 | 431 |
447 void ServiceWorkerHandler::ClearForceUpdate() { | 432 void ServiceWorkerHandler::ClearForceUpdate() { |
448 if (context_) | 433 if (context_) |
449 context_->SetForceUpdateOnPageLoad(false); | 434 context_->SetForceUpdateOnPageLoad(false); |
450 } | 435 } |
451 | 436 |
452 } // namespace service_worker | 437 } // namespace protocol |
453 } // namespace devtools | |
454 } // namespace content | 438 } // namespace content |
OLD | NEW |