Chromium Code Reviews| 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; |
|
caseq
2016/12/14 20:06:24
default: NOTREACHED()?
dgozman
2016/12/14 22:00:01
Done.
| |
| 68 } | 65 } |
| 69 return std::string(); | 66 return std::string(); |
| 70 } | 67 } |
| 71 | 68 |
| 72 const std::string GetVersionStatusString( | 69 const std::string GetVersionStatusString( |
| 73 content::ServiceWorkerVersion::Status status) { | 70 content::ServiceWorkerVersion::Status status) { |
| 74 switch (status) { | 71 switch (status) { |
| 75 case content::ServiceWorkerVersion::NEW: | 72 case content::ServiceWorkerVersion::NEW: |
| 76 return kServiceWorkerVersionStatusNew; | 73 return ServiceWorker::ServiceWorkerVersionStatusEnum::New; |
| 77 case content::ServiceWorkerVersion::INSTALLING: | 74 case content::ServiceWorkerVersion::INSTALLING: |
| 78 return kServiceWorkerVersionStatusInstalling; | 75 return ServiceWorker::ServiceWorkerVersionStatusEnum::Installing; |
| 79 case content::ServiceWorkerVersion::INSTALLED: | 76 case content::ServiceWorkerVersion::INSTALLED: |
| 80 return kServiceWorkerVersionStatusInstalled; | 77 return ServiceWorker::ServiceWorkerVersionStatusEnum::Installed; |
| 81 case content::ServiceWorkerVersion::ACTIVATING: | 78 case content::ServiceWorkerVersion::ACTIVATING: |
| 82 return kServiceWorkerVersionStatusActivating; | 79 return ServiceWorker::ServiceWorkerVersionStatusEnum::Activating; |
| 83 case content::ServiceWorkerVersion::ACTIVATED: | 80 case content::ServiceWorkerVersion::ACTIVATED: |
| 84 return kServiceWorkerVersionStatusActivated; | 81 return ServiceWorker::ServiceWorkerVersionStatusEnum::Activated; |
| 85 case content::ServiceWorkerVersion::REDUNDANT: | 82 case content::ServiceWorkerVersion::REDUNDANT: |
| 86 return kServiceWorkerVersionStatusRedundant; | 83 return ServiceWorker::ServiceWorkerVersionStatusEnum::Redundant; |
|
caseq
2016/12/14 20:06:24
ditto.
| |
| 87 } | 84 } |
| 88 return std::string(); | 85 return std::string(); |
| 89 } | 86 } |
| 90 | 87 |
| 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, | 88 void StopServiceWorkerOnIO(scoped_refptr<ServiceWorkerContextWrapper> context, |
| 154 int64_t version_id) { | 89 int64_t version_id) { |
| 155 if (content::ServiceWorkerVersion* version = | 90 if (content::ServiceWorkerVersion* version = |
| 156 context->GetLiveVersion(version_id)) { | 91 context->GetLiveVersion(version_id)) { |
| 157 version->StopWorker(base::Bind(&StatusNoOp)); | 92 version->StopWorker(base::Bind(&StatusNoOp)); |
| 158 } | 93 } |
| 159 } | 94 } |
| 160 | 95 |
| 161 void GetDevToolsRouteInfoOnIO( | 96 void GetDevToolsRouteInfoOnIO( |
| 162 scoped_refptr<ServiceWorkerContextWrapper> context, | 97 scoped_refptr<ServiceWorkerContextWrapper> context, |
| 163 int64_t version_id, | 98 int64_t version_id, |
| 164 const base::Callback<void(int, int)>& callback) { | 99 const base::Callback<void(int, int)>& callback) { |
| 165 if (content::ServiceWorkerVersion* version = | 100 if (content::ServiceWorkerVersion* version = |
| 166 context->GetLiveVersion(version_id)) { | 101 context->GetLiveVersion(version_id)) { |
| 167 BrowserThread::PostTask( | 102 BrowserThread::PostTask( |
| 168 BrowserThread::UI, FROM_HERE, | 103 BrowserThread::UI, FROM_HERE, |
| 169 base::Bind( | 104 base::Bind( |
| 170 callback, version->embedded_worker()->process_id(), | 105 callback, version->embedded_worker()->process_id(), |
| 171 version->embedded_worker()->worker_devtools_agent_route_id())); | 106 version->embedded_worker()->worker_devtools_agent_route_id())); |
| 172 } | 107 } |
| 173 } | 108 } |
| 174 | 109 |
| 175 Response CreateContextErrorResponse() { | 110 Response CreateContextErrorResponse() { |
| 176 return Response::InternalError("Could not connect to the context"); | 111 return Response::Error("Could not connect to the context"); |
| 177 } | 112 } |
| 178 | 113 |
| 179 Response CreateInvalidVersionIdErrorResponse() { | 114 Response CreateInvalidVersionIdErrorResponse() { |
| 180 return Response::InternalError("Invalid version ID"); | 115 return Response::InvalidParams("Invalid version ID"); |
| 181 } | 116 } |
| 182 | 117 |
| 183 void DidFindRegistrationForDispatchSyncEventOnIO( | 118 void DidFindRegistrationForDispatchSyncEventOnIO( |
| 184 scoped_refptr<BackgroundSyncContext> sync_context, | 119 scoped_refptr<BackgroundSyncContext> sync_context, |
| 185 const std::string& tag, | 120 const std::string& tag, |
| 186 bool last_chance, | 121 bool last_chance, |
| 187 ServiceWorkerStatusCode status, | 122 ServiceWorkerStatusCode status, |
| 188 scoped_refptr<content::ServiceWorkerRegistration> registration) { | 123 scoped_refptr<content::ServiceWorkerRegistration> registration) { |
| 189 if (status != SERVICE_WORKER_OK || !registration->active_version()) | 124 if (status != SERVICE_WORKER_OK || !registration->active_version()) |
| 190 return; | 125 return; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 210 tag, last_chance)); | 145 tag, last_chance)); |
| 211 } | 146 } |
| 212 | 147 |
| 213 } // namespace | 148 } // namespace |
| 214 | 149 |
| 215 ServiceWorkerHandler::ServiceWorkerHandler() | 150 ServiceWorkerHandler::ServiceWorkerHandler() |
| 216 : enabled_(false), render_frame_host_(nullptr), weak_factory_(this) { | 151 : enabled_(false), render_frame_host_(nullptr), weak_factory_(this) { |
| 217 } | 152 } |
| 218 | 153 |
| 219 ServiceWorkerHandler::~ServiceWorkerHandler() { | 154 ServiceWorkerHandler::~ServiceWorkerHandler() { |
| 220 Disable(); | 155 } |
| 156 | |
| 157 void ServiceWorkerHandler::Wire(UberDispatcher* dispatcher) { | |
| 158 frontend_.reset(new ServiceWorker::Frontend(dispatcher->channel())); | |
| 159 ServiceWorker::Dispatcher::wire(dispatcher, this); | |
| 221 } | 160 } |
| 222 | 161 |
| 223 void ServiceWorkerHandler::SetRenderFrameHost( | 162 void ServiceWorkerHandler::SetRenderFrameHost( |
| 224 RenderFrameHostImpl* render_frame_host) { | 163 RenderFrameHostImpl* render_frame_host) { |
| 225 render_frame_host_ = render_frame_host; | 164 render_frame_host_ = render_frame_host; |
| 226 // Do not call UpdateHosts yet, wait for load to commit. | 165 // Do not call UpdateHosts yet, wait for load to commit. |
| 227 if (!render_frame_host) { | 166 if (!render_frame_host) { |
| 228 ClearForceUpdate(); | 167 ClearForceUpdate(); |
| 229 context_ = nullptr; | 168 context_ = nullptr; |
| 230 return; | 169 return; |
| 231 } | 170 } |
| 232 StoragePartition* partition = BrowserContext::GetStoragePartition( | 171 StoragePartition* partition = BrowserContext::GetStoragePartition( |
| 233 render_frame_host->GetProcess()->GetBrowserContext(), | 172 render_frame_host->GetProcess()->GetBrowserContext(), |
| 234 render_frame_host->GetSiteInstance()); | 173 render_frame_host->GetSiteInstance()); |
| 235 DCHECK(partition); | 174 DCHECK(partition); |
| 236 context_ = static_cast<ServiceWorkerContextWrapper*>( | 175 context_ = static_cast<ServiceWorkerContextWrapper*>( |
| 237 partition->GetServiceWorkerContext()); | 176 partition->GetServiceWorkerContext()); |
| 238 } | 177 } |
| 239 | 178 |
| 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() { | 179 Response ServiceWorkerHandler::Enable() { |
| 249 if (enabled_) | 180 if (enabled_) |
| 250 return Response::OK(); | 181 return Response::OK(); |
| 251 if (!context_) | 182 if (!context_) |
| 252 return Response::InternalError("Could not connect to the context"); | 183 return CreateContextErrorResponse(); |
| 253 enabled_ = true; | 184 enabled_ = true; |
| 254 | 185 |
| 255 context_watcher_ = new ServiceWorkerContextWatcher( | 186 context_watcher_ = new ServiceWorkerContextWatcher( |
| 256 context_, base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, | 187 context_, base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, |
| 257 weak_factory_.GetWeakPtr()), | 188 weak_factory_.GetWeakPtr()), |
| 258 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, | 189 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, |
| 259 weak_factory_.GetWeakPtr()), | 190 weak_factory_.GetWeakPtr()), |
| 260 base::Bind(&ServiceWorkerHandler::OnErrorReported, | 191 base::Bind(&ServiceWorkerHandler::OnErrorReported, |
| 261 weak_factory_.GetWeakPtr())); | 192 weak_factory_.GetWeakPtr())); |
| 262 context_watcher_->Start(); | 193 context_watcher_->Start(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 scoped_refptr<DevToolsAgentHostImpl> agent_host( | 333 scoped_refptr<DevToolsAgentHostImpl> agent_host( |
| 403 ServiceWorkerDevToolsManager::GetInstance() | 334 ServiceWorkerDevToolsManager::GetInstance() |
| 404 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); | 335 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); |
| 405 if (!agent_host.get()) | 336 if (!agent_host.get()) |
| 406 return; | 337 return; |
| 407 agent_host->Inspect(); | 338 agent_host->Inspect(); |
| 408 } | 339 } |
| 409 | 340 |
| 410 void ServiceWorkerHandler::OnWorkerRegistrationUpdated( | 341 void ServiceWorkerHandler::OnWorkerRegistrationUpdated( |
| 411 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { | 342 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { |
| 412 std::vector<scoped_refptr<ServiceWorkerRegistration>> registration_values; | 343 using Registration = ServiceWorker::ServiceWorkerRegistration; |
| 344 std::unique_ptr<protocol::Array<Registration>> result = | |
| 345 protocol::Array<Registration>::create(); | |
| 413 for (const auto& registration : registrations) { | 346 for (const auto& registration : registrations) { |
| 414 registration_values.push_back( | 347 result->addItem(Registration::Create() |
| 415 CreateRegistrationDictionaryValue(registration)); | 348 .SetRegistrationId( |
| 349 base::Int64ToString(registration.registration_id)) | |
| 350 .SetScopeURL(registration.pattern.spec()) | |
| 351 .SetIsDeleted(registration.delete_flag == | |
| 352 ServiceWorkerRegistrationInfo::IS_DELETED) | |
| 353 .Build()); | |
| 416 } | 354 } |
| 417 client_->WorkerRegistrationUpdated( | 355 frontend_->WorkerRegistrationUpdated(std::move(result)); |
| 418 WorkerRegistrationUpdatedParams::Create()->set_registrations( | |
| 419 registration_values)); | |
| 420 } | 356 } |
| 421 | 357 |
| 422 void ServiceWorkerHandler::OnWorkerVersionUpdated( | 358 void ServiceWorkerHandler::OnWorkerVersionUpdated( |
| 423 const std::vector<ServiceWorkerVersionInfo>& versions) { | 359 const std::vector<ServiceWorkerVersionInfo>& versions) { |
| 424 std::vector<scoped_refptr<ServiceWorkerVersion>> version_values; | 360 using Version = ServiceWorker::ServiceWorkerVersion; |
| 361 std::unique_ptr<protocol::Array<Version>> result = | |
| 362 protocol::Array<Version>::create(); | |
| 425 for (const auto& version : versions) { | 363 for (const auto& version : versions) { |
| 426 version_values.push_back(CreateVersionDictionaryValue(version)); | 364 std::unique_ptr<protocol::Array<std::string>> clients = |
| 365 protocol::Array<std::string>::create(); | |
| 366 for (const auto& client : version.clients) { | |
| 367 if (client.second.type == SERVICE_WORKER_PROVIDER_FOR_WINDOW) { | |
| 368 RenderFrameHostImpl* render_frame_host = RenderFrameHostImpl::FromID( | |
| 369 client.second.process_id, client.second.route_id); | |
| 370 WebContents* web_contents = | |
| 371 WebContents::FromRenderFrameHost(render_frame_host); | |
| 372 // There is a possibility that the frame is already deleted | |
| 373 // because of the thread hopping. | |
| 374 if (!web_contents) | |
| 375 continue; | |
| 376 scoped_refptr<DevToolsAgentHost> agent_host( | |
| 377 DevToolsAgentHost::GetOrCreateFor(web_contents)); | |
| 378 if (agent_host) | |
|
caseq
2016/12/14 20:06:24
no need for this check -- though I wonder if GetOr
dgozman
2016/12/14 22:00:01
I think it is intentional. Fixed the check.
| |
| 379 clients->addItem(agent_host->GetId()); | |
| 380 } else if (client.second.type == | |
| 381 SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER) { | |
| 382 scoped_refptr<DevToolsAgentHost> agent_host( | |
| 383 DevToolsAgentHost::GetForWorker(client.second.process_id, | |
| 384 client.second.route_id)); | |
| 385 if (agent_host) | |
| 386 clients->addItem(agent_host->GetId()); | |
| 387 } | |
| 388 } | |
| 389 std::unique_ptr<Version> version_value = Version::Create() | |
| 390 .SetVersionId(base::Int64ToString(version.version_id)) | |
| 391 .SetRegistrationId( | |
| 392 base::Int64ToString(version.registration_id)) | |
| 393 .SetScriptURL(version.script_url.spec()) | |
| 394 .SetRunningStatus( | |
| 395 GetVersionRunningStatusString(version.running_status)) | |
| 396 .SetStatus(GetVersionStatusString(version.status)) | |
| 397 .SetScriptLastModified( | |
| 398 version.script_last_modified.ToDoubleT()) | |
| 399 .SetScriptResponseTime( | |
| 400 version.script_response_time.ToDoubleT()) | |
| 401 .SetControlledClients(std::move(clients)) | |
| 402 .Build(); | |
| 403 scoped_refptr<DevToolsAgentHostImpl> host( | |
| 404 ServiceWorkerDevToolsManager::GetInstance() | |
| 405 ->GetDevToolsAgentHostForWorker( | |
| 406 version.process_id, | |
| 407 version.devtools_agent_route_id)); | |
| 408 if (host) | |
| 409 version_value->SetTargetId(host->GetId()); | |
| 410 result->addItem(std::move(version_value)); | |
| 427 } | 411 } |
| 428 client_->WorkerVersionUpdated( | 412 frontend_->WorkerVersionUpdated(std::move(result)); |
| 429 WorkerVersionUpdatedParams::Create()->set_versions(version_values)); | |
| 430 } | 413 } |
| 431 | 414 |
| 432 void ServiceWorkerHandler::OnErrorReported( | 415 void ServiceWorkerHandler::OnErrorReported( |
| 433 int64_t registration_id, | 416 int64_t registration_id, |
| 434 int64_t version_id, | 417 int64_t version_id, |
| 435 const ServiceWorkerContextObserver::ErrorInfo& info) { | 418 const ServiceWorkerContextObserver::ErrorInfo& info) { |
| 436 client_->WorkerErrorReported( | 419 frontend_->WorkerErrorReported( |
| 437 WorkerErrorReportedParams::Create()->set_error_message( | 420 ServiceWorker::ServiceWorkerErrorMessage::Create() |
| 438 ServiceWorkerErrorMessage::Create() | 421 .SetErrorMessage(base::UTF16ToUTF8(info.error_message)) |
| 439 ->set_error_message(base::UTF16ToUTF8(info.error_message)) | 422 .SetRegistrationId(base::Int64ToString(registration_id)) |
| 440 ->set_registration_id(base::Int64ToString(registration_id)) | 423 .SetVersionId(base::Int64ToString(version_id)) |
| 441 ->set_version_id(base::Int64ToString(version_id)) | 424 .SetSourceURL(info.source_url.spec()) |
| 442 ->set_source_url(info.source_url.spec()) | 425 .SetLineNumber(info.line_number) |
| 443 ->set_line_number(info.line_number) | 426 .SetColumnNumber(info.column_number) |
| 444 ->set_column_number(info.column_number))); | 427 .Build()); |
| 445 } | 428 } |
| 446 | 429 |
| 447 void ServiceWorkerHandler::ClearForceUpdate() { | 430 void ServiceWorkerHandler::ClearForceUpdate() { |
| 448 if (context_) | 431 if (context_) |
| 449 context_->SetForceUpdateOnPageLoad(false); | 432 context_->SetForceUpdateOnPageLoad(false); |
| 450 } | 433 } |
| 451 | 434 |
| 452 } // namespace service_worker | 435 } // namespace protocol |
| 453 } // namespace devtools | |
| 454 } // namespace content | 436 } // namespace content |
| OLD | NEW |