| 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 protocol { | 36 namespace devtools { |
| 37 namespace service_worker { |
| 38 |
| 39 using Response = DevToolsProtocolClient::Response; |
| 37 | 40 |
| 38 namespace { | 41 namespace { |
| 39 | 42 |
| 40 void ResultNoOp(bool success) { | 43 void ResultNoOp(bool success) { |
| 41 } | 44 } |
| 42 | 45 |
| 43 void StatusNoOp(ServiceWorkerStatusCode status) { | 46 void StatusNoOp(ServiceWorkerStatusCode status) { |
| 44 } | 47 } |
| 45 | 48 |
| 46 void StatusNoOpKeepingRegistration( | 49 void StatusNoOpKeepingRegistration( |
| 47 scoped_refptr<content::ServiceWorkerRegistration> protect, | 50 scoped_refptr<content::ServiceWorkerRegistration> protect, |
| 48 ServiceWorkerStatusCode status) { | 51 ServiceWorkerStatusCode status) { |
| 49 } | 52 } |
| 50 | 53 |
| 51 void PushDeliveryNoOp(PushDeliveryStatus status) { | 54 void PushDeliveryNoOp(PushDeliveryStatus status) { |
| 52 } | 55 } |
| 53 | 56 |
| 54 const std::string GetVersionRunningStatusString( | 57 const std::string GetVersionRunningStatusString( |
| 55 EmbeddedWorkerStatus running_status) { | 58 EmbeddedWorkerStatus running_status) { |
| 56 switch (running_status) { | 59 switch (running_status) { |
| 57 case EmbeddedWorkerStatus::STOPPED: | 60 case EmbeddedWorkerStatus::STOPPED: |
| 58 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Stopped; | 61 return kServiceWorkerVersionRunningStatusStopped; |
| 59 case EmbeddedWorkerStatus::STARTING: | 62 case EmbeddedWorkerStatus::STARTING: |
| 60 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Starting; | 63 return kServiceWorkerVersionRunningStatusStarting; |
| 61 case EmbeddedWorkerStatus::RUNNING: | 64 case EmbeddedWorkerStatus::RUNNING: |
| 62 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Running; | 65 return kServiceWorkerVersionRunningStatusRunning; |
| 63 case EmbeddedWorkerStatus::STOPPING: | 66 case EmbeddedWorkerStatus::STOPPING: |
| 64 return ServiceWorker::ServiceWorkerVersionRunningStatusEnum::Stopping; | 67 return kServiceWorkerVersionRunningStatusStopping; |
| 65 default: | |
| 66 NOTREACHED(); | |
| 67 } | 68 } |
| 68 return std::string(); | 69 return std::string(); |
| 69 } | 70 } |
| 70 | 71 |
| 71 const std::string GetVersionStatusString( | 72 const std::string GetVersionStatusString( |
| 72 content::ServiceWorkerVersion::Status status) { | 73 content::ServiceWorkerVersion::Status status) { |
| 73 switch (status) { | 74 switch (status) { |
| 74 case content::ServiceWorkerVersion::NEW: | 75 case content::ServiceWorkerVersion::NEW: |
| 75 return ServiceWorker::ServiceWorkerVersionStatusEnum::New; | 76 return kServiceWorkerVersionStatusNew; |
| 76 case content::ServiceWorkerVersion::INSTALLING: | 77 case content::ServiceWorkerVersion::INSTALLING: |
| 77 return ServiceWorker::ServiceWorkerVersionStatusEnum::Installing; | 78 return kServiceWorkerVersionStatusInstalling; |
| 78 case content::ServiceWorkerVersion::INSTALLED: | 79 case content::ServiceWorkerVersion::INSTALLED: |
| 79 return ServiceWorker::ServiceWorkerVersionStatusEnum::Installed; | 80 return kServiceWorkerVersionStatusInstalled; |
| 80 case content::ServiceWorkerVersion::ACTIVATING: | 81 case content::ServiceWorkerVersion::ACTIVATING: |
| 81 return ServiceWorker::ServiceWorkerVersionStatusEnum::Activating; | 82 return kServiceWorkerVersionStatusActivating; |
| 82 case content::ServiceWorkerVersion::ACTIVATED: | 83 case content::ServiceWorkerVersion::ACTIVATED: |
| 83 return ServiceWorker::ServiceWorkerVersionStatusEnum::Activated; | 84 return kServiceWorkerVersionStatusActivated; |
| 84 case content::ServiceWorkerVersion::REDUNDANT: | 85 case content::ServiceWorkerVersion::REDUNDANT: |
| 85 return ServiceWorker::ServiceWorkerVersionStatusEnum::Redundant; | 86 return kServiceWorkerVersionStatusRedundant; |
| 86 default: | |
| 87 NOTREACHED(); | |
| 88 } | 87 } |
| 89 return std::string(); | 88 return std::string(); |
| 90 } | 89 } |
| 91 | 90 |
| 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 |
| 92 void StopServiceWorkerOnIO(scoped_refptr<ServiceWorkerContextWrapper> context, | 153 void StopServiceWorkerOnIO(scoped_refptr<ServiceWorkerContextWrapper> context, |
| 93 int64_t version_id) { | 154 int64_t version_id) { |
| 94 if (content::ServiceWorkerVersion* version = | 155 if (content::ServiceWorkerVersion* version = |
| 95 context->GetLiveVersion(version_id)) { | 156 context->GetLiveVersion(version_id)) { |
| 96 version->StopWorker(base::Bind(&StatusNoOp)); | 157 version->StopWorker(base::Bind(&StatusNoOp)); |
| 97 } | 158 } |
| 98 } | 159 } |
| 99 | 160 |
| 100 void GetDevToolsRouteInfoOnIO( | 161 void GetDevToolsRouteInfoOnIO( |
| 101 scoped_refptr<ServiceWorkerContextWrapper> context, | 162 scoped_refptr<ServiceWorkerContextWrapper> context, |
| 102 int64_t version_id, | 163 int64_t version_id, |
| 103 const base::Callback<void(int, int)>& callback) { | 164 const base::Callback<void(int, int)>& callback) { |
| 104 if (content::ServiceWorkerVersion* version = | 165 if (content::ServiceWorkerVersion* version = |
| 105 context->GetLiveVersion(version_id)) { | 166 context->GetLiveVersion(version_id)) { |
| 106 BrowserThread::PostTask( | 167 BrowserThread::PostTask( |
| 107 BrowserThread::UI, FROM_HERE, | 168 BrowserThread::UI, FROM_HERE, |
| 108 base::Bind( | 169 base::Bind( |
| 109 callback, version->embedded_worker()->process_id(), | 170 callback, version->embedded_worker()->process_id(), |
| 110 version->embedded_worker()->worker_devtools_agent_route_id())); | 171 version->embedded_worker()->worker_devtools_agent_route_id())); |
| 111 } | 172 } |
| 112 } | 173 } |
| 113 | 174 |
| 114 Response CreateContextErrorResponse() { | 175 Response CreateContextErrorResponse() { |
| 115 return Response::Error("Could not connect to the context"); | 176 return Response::InternalError("Could not connect to the context"); |
| 116 } | 177 } |
| 117 | 178 |
| 118 Response CreateInvalidVersionIdErrorResponse() { | 179 Response CreateInvalidVersionIdErrorResponse() { |
| 119 return Response::InvalidParams("Invalid version ID"); | 180 return Response::InternalError("Invalid version ID"); |
| 120 } | 181 } |
| 121 | 182 |
| 122 void DidFindRegistrationForDispatchSyncEventOnIO( | 183 void DidFindRegistrationForDispatchSyncEventOnIO( |
| 123 scoped_refptr<BackgroundSyncContext> sync_context, | 184 scoped_refptr<BackgroundSyncContext> sync_context, |
| 124 const std::string& tag, | 185 const std::string& tag, |
| 125 bool last_chance, | 186 bool last_chance, |
| 126 ServiceWorkerStatusCode status, | 187 ServiceWorkerStatusCode status, |
| 127 scoped_refptr<content::ServiceWorkerRegistration> registration) { | 188 scoped_refptr<content::ServiceWorkerRegistration> registration) { |
| 128 if (status != SERVICE_WORKER_OK || !registration->active_version()) | 189 if (status != SERVICE_WORKER_OK || !registration->active_version()) |
| 129 return; | 190 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 149 tag, last_chance)); | 210 tag, last_chance)); |
| 150 } | 211 } |
| 151 | 212 |
| 152 } // namespace | 213 } // namespace |
| 153 | 214 |
| 154 ServiceWorkerHandler::ServiceWorkerHandler() | 215 ServiceWorkerHandler::ServiceWorkerHandler() |
| 155 : enabled_(false), render_frame_host_(nullptr), weak_factory_(this) { | 216 : enabled_(false), render_frame_host_(nullptr), weak_factory_(this) { |
| 156 } | 217 } |
| 157 | 218 |
| 158 ServiceWorkerHandler::~ServiceWorkerHandler() { | 219 ServiceWorkerHandler::~ServiceWorkerHandler() { |
| 159 } | 220 Disable(); |
| 160 | |
| 161 void ServiceWorkerHandler::Wire(UberDispatcher* dispatcher) { | |
| 162 frontend_.reset(new ServiceWorker::Frontend(dispatcher->channel())); | |
| 163 ServiceWorker::Dispatcher::wire(dispatcher, this); | |
| 164 } | 221 } |
| 165 | 222 |
| 166 void ServiceWorkerHandler::SetRenderFrameHost( | 223 void ServiceWorkerHandler::SetRenderFrameHost( |
| 167 RenderFrameHostImpl* render_frame_host) { | 224 RenderFrameHostImpl* render_frame_host) { |
| 168 render_frame_host_ = render_frame_host; | 225 render_frame_host_ = render_frame_host; |
| 169 // Do not call UpdateHosts yet, wait for load to commit. | 226 // Do not call UpdateHosts yet, wait for load to commit. |
| 170 if (!render_frame_host) { | 227 if (!render_frame_host) { |
| 171 ClearForceUpdate(); | 228 ClearForceUpdate(); |
| 172 context_ = nullptr; | 229 context_ = nullptr; |
| 173 return; | 230 return; |
| 174 } | 231 } |
| 175 StoragePartition* partition = BrowserContext::GetStoragePartition( | 232 StoragePartition* partition = BrowserContext::GetStoragePartition( |
| 176 render_frame_host->GetProcess()->GetBrowserContext(), | 233 render_frame_host->GetProcess()->GetBrowserContext(), |
| 177 render_frame_host->GetSiteInstance()); | 234 render_frame_host->GetSiteInstance()); |
| 178 DCHECK(partition); | 235 DCHECK(partition); |
| 179 context_ = static_cast<ServiceWorkerContextWrapper*>( | 236 context_ = static_cast<ServiceWorkerContextWrapper*>( |
| 180 partition->GetServiceWorkerContext()); | 237 partition->GetServiceWorkerContext()); |
| 181 } | 238 } |
| 182 | 239 |
| 240 void ServiceWorkerHandler::SetClient(std::unique_ptr<Client> client) { |
| 241 client_.swap(client); |
| 242 } |
| 243 |
| 244 void ServiceWorkerHandler::Detached() { |
| 245 Disable(); |
| 246 } |
| 247 |
| 183 Response ServiceWorkerHandler::Enable() { | 248 Response ServiceWorkerHandler::Enable() { |
| 184 if (enabled_) | 249 if (enabled_) |
| 185 return Response::OK(); | 250 return Response::OK(); |
| 186 if (!context_) | 251 if (!context_) |
| 187 return CreateContextErrorResponse(); | 252 return Response::InternalError("Could not connect to the context"); |
| 188 enabled_ = true; | 253 enabled_ = true; |
| 189 | 254 |
| 190 context_watcher_ = new ServiceWorkerContextWatcher( | 255 context_watcher_ = new ServiceWorkerContextWatcher( |
| 191 context_, base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, | 256 context_, base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, |
| 192 weak_factory_.GetWeakPtr()), | 257 weak_factory_.GetWeakPtr()), |
| 193 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, | 258 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, |
| 194 weak_factory_.GetWeakPtr()), | 259 weak_factory_.GetWeakPtr()), |
| 195 base::Bind(&ServiceWorkerHandler::OnErrorReported, | 260 base::Bind(&ServiceWorkerHandler::OnErrorReported, |
| 196 weak_factory_.GetWeakPtr())); | 261 weak_factory_.GetWeakPtr())); |
| 197 context_watcher_->Start(); | 262 context_watcher_->Start(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 scoped_refptr<DevToolsAgentHostImpl> agent_host( | 402 scoped_refptr<DevToolsAgentHostImpl> agent_host( |
| 338 ServiceWorkerDevToolsManager::GetInstance() | 403 ServiceWorkerDevToolsManager::GetInstance() |
| 339 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); | 404 ->GetDevToolsAgentHostForWorker(process_id, devtools_agent_route_id)); |
| 340 if (!agent_host.get()) | 405 if (!agent_host.get()) |
| 341 return; | 406 return; |
| 342 agent_host->Inspect(); | 407 agent_host->Inspect(); |
| 343 } | 408 } |
| 344 | 409 |
| 345 void ServiceWorkerHandler::OnWorkerRegistrationUpdated( | 410 void ServiceWorkerHandler::OnWorkerRegistrationUpdated( |
| 346 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { | 411 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { |
| 347 using Registration = ServiceWorker::ServiceWorkerRegistration; | 412 std::vector<scoped_refptr<ServiceWorkerRegistration>> registration_values; |
| 348 std::unique_ptr<protocol::Array<Registration>> result = | |
| 349 protocol::Array<Registration>::create(); | |
| 350 for (const auto& registration : registrations) { | 413 for (const auto& registration : registrations) { |
| 351 result->addItem(Registration::Create() | 414 registration_values.push_back( |
| 352 .SetRegistrationId( | 415 CreateRegistrationDictionaryValue(registration)); |
| 353 base::Int64ToString(registration.registration_id)) | |
| 354 .SetScopeURL(registration.pattern.spec()) | |
| 355 .SetIsDeleted(registration.delete_flag == | |
| 356 ServiceWorkerRegistrationInfo::IS_DELETED) | |
| 357 .Build()); | |
| 358 } | 416 } |
| 359 frontend_->WorkerRegistrationUpdated(std::move(result)); | 417 client_->WorkerRegistrationUpdated( |
| 418 WorkerRegistrationUpdatedParams::Create()->set_registrations( |
| 419 registration_values)); |
| 360 } | 420 } |
| 361 | 421 |
| 362 void ServiceWorkerHandler::OnWorkerVersionUpdated( | 422 void ServiceWorkerHandler::OnWorkerVersionUpdated( |
| 363 const std::vector<ServiceWorkerVersionInfo>& versions) { | 423 const std::vector<ServiceWorkerVersionInfo>& versions) { |
| 364 using Version = ServiceWorker::ServiceWorkerVersion; | 424 std::vector<scoped_refptr<ServiceWorkerVersion>> version_values; |
| 365 std::unique_ptr<protocol::Array<Version>> result = | |
| 366 protocol::Array<Version>::create(); | |
| 367 for (const auto& version : versions) { | 425 for (const auto& version : versions) { |
| 368 std::unique_ptr<protocol::Array<std::string>> clients = | 426 version_values.push_back(CreateVersionDictionaryValue(version)); |
| 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)); | |
| 413 } | 427 } |
| 414 frontend_->WorkerVersionUpdated(std::move(result)); | 428 client_->WorkerVersionUpdated( |
| 429 WorkerVersionUpdatedParams::Create()->set_versions(version_values)); |
| 415 } | 430 } |
| 416 | 431 |
| 417 void ServiceWorkerHandler::OnErrorReported( | 432 void ServiceWorkerHandler::OnErrorReported( |
| 418 int64_t registration_id, | 433 int64_t registration_id, |
| 419 int64_t version_id, | 434 int64_t version_id, |
| 420 const ServiceWorkerContextObserver::ErrorInfo& info) { | 435 const ServiceWorkerContextObserver::ErrorInfo& info) { |
| 421 frontend_->WorkerErrorReported( | 436 client_->WorkerErrorReported( |
| 422 ServiceWorker::ServiceWorkerErrorMessage::Create() | 437 WorkerErrorReportedParams::Create()->set_error_message( |
| 423 .SetErrorMessage(base::UTF16ToUTF8(info.error_message)) | 438 ServiceWorkerErrorMessage::Create() |
| 424 .SetRegistrationId(base::Int64ToString(registration_id)) | 439 ->set_error_message(base::UTF16ToUTF8(info.error_message)) |
| 425 .SetVersionId(base::Int64ToString(version_id)) | 440 ->set_registration_id(base::Int64ToString(registration_id)) |
| 426 .SetSourceURL(info.source_url.spec()) | 441 ->set_version_id(base::Int64ToString(version_id)) |
| 427 .SetLineNumber(info.line_number) | 442 ->set_source_url(info.source_url.spec()) |
| 428 .SetColumnNumber(info.column_number) | 443 ->set_line_number(info.line_number) |
| 429 .Build()); | 444 ->set_column_number(info.column_number))); |
| 430 } | 445 } |
| 431 | 446 |
| 432 void ServiceWorkerHandler::ClearForceUpdate() { | 447 void ServiceWorkerHandler::ClearForceUpdate() { |
| 433 if (context_) | 448 if (context_) |
| 434 context_->SetForceUpdateOnPageLoad(false); | 449 context_->SetForceUpdateOnPageLoad(false); |
| 435 } | 450 } |
| 436 | 451 |
| 437 } // namespace protocol | 452 } // namespace service_worker |
| 453 } // namespace devtools |
| 438 } // namespace content | 454 } // namespace content |
| OLD | NEW |